Developing and Implementing Windows-based Applications with Microsoft Visual C# .NET and Microsoft Visual Studio.NET develop and implement Windows-based applications by using Windows Forms and the Microsoft .NET Framework. This exam counts as a core credit toward the new MCAD (Microsoft Certified Application Developer) certification as well as a core credit toward the MCSD .NET certification. This book is not intended to teach new material. Instead it assumes . Contents PART I Developing Windows Applications 1 Introducing Windows Forms 21 2 Controls 113 3 Error Handling for the User Interface 229 4 Creating and Managing .NET Components and Assemblies 283 5 Data Binding 353 6 Consuming and Manipulating Data 427 7 Web Services 565 8 Globalization 599 9 Working with Legacy Code 641 10 User Assistance and Accessibility 677 11 Printing 729 12 Testing and Debugging a Windows Application 775 00 0789728230 FM 11/21/02 1:22 PM Page v Appendix A: C# Language Fundamentals Appendix B: Conversions Appendix C: Math Class Appendix D: String Theory Appendix E: Files and Streams TABLE OF CONTENTS PART I: Developing Window Applications 1 Introducing Windows Forms 21 Introduction 24 Key Concepts 24 An Overview of the .NET Framework 25 An Overview of the Development Tools 27 Understanding Classes, Inheritance, and Namespaces 29 Creating a Windows Forms Application 32 Using the System.Windows.Forms.Form Class 33 Designing a Windows Form by Using the Windows Forms Designer 34 Exploring the Generated Code 37 Running a Windows Form 40 Using the Application Class 42 Using the MessageBox Class 46 Setting and Adding Properties to a Windows Form 48 Using the Visual Designer to Set Windows Form Properties 48 Setting Windows Form Properties Programmatically 51 Adding New Properties to a Windows Form 57 Using Visual Inheritance 61 Event Handling 64 Handling Events by Attaching a Delegate 65 Handling Events by Overriding a Protected Method of a Base Class 71 Building Graphical Interface Elements by Using the System.Drawing Namespace 76 Understanding the Graphics Objects 77 Understanding the Windows Forms Coordinate System 78 Drawing Text on a Form 79 Drawing Shapes 85 Working with Images 94 Exercises 102 Introduction 116 Adding Controls to a Windows Form 116 Adding Controls by Using the Windows Forms Designer 117 Adding Controls Programmatically 118 Setting Properties of Controls 120 Important Common Properties of Controls 121 Configuring the Order of Tabs 125 Handling Control Events 126 Dialog Boxes 135 Common Dialog Boxes 135 Creating a Custom Dialog Box 139 Common Windows Forms Controls 142 The Label and LinkLabel Controls 143 The TextBox and RichTextBox Controls 146 The PictureBox Control 148 The GroupBox and Panel Controls 149 The Button, CheckBox, and RadioButton Controls 151 The ListBox, CheckedListBox, and ComboBox Controls 155 The DomainUpDown and NumericUpDown Controls 165 The MonthCalendar and DateTimePicker Controls 168 The Timer 172 The rackBar, and ProgressBar Controls 177 The HScrollBar and VScrollBar Controls 180 The TabControl Control 183 Creating Menus and Menu Items 187 The MainMenu Control 189 The ContextMenu Control 197 The StatusBar Control 203 The ToolBar Control 207 Creating MDI Applications 210 Exercises 218 Review Questions 220 Introduction 231 Understanding Exceptions 231 Handling Exceptions 234 The try Block 235 The catch Block 235 The throw Statement 239 The finally Block 240 Creating and Using Custom Exceptions 244 Managing Unhandled Exceptions 250 Validating User Input 255 Keystroke-Level Validation 256 Field-Level Validation 258 Enabling Controls Based on Input 263 Other Properties for Validation 264 Exercises 270 12 Testing and Debugging a Windows Application Introduction 778 Testing 778 Creating a Test Plan 779 Executing Tests 779 Testing International Applications 782 Tracing 783 Using Trace and Debug to Display Information 786 Trace Listeners 789 Trace Switches 793 Conditional Compilation 797 Debugging 802 Stepping Through Program Execution 803 Setting Breakpoints 806 Analyzing Program State to Resolve Errors 809 Debugging on Exceptions 813 Debugging a Running Process 815