Rod Stephens is a programming guru, C# specialist, and the author of 30 programming books covering C#, Java, VB, and more. His C# Helper website (www.csharphelper.com) is a trusted resource in the programming community, receiving tens of thousands of monthly hits for the helpful tips, tricks, and code for professional C# programmers. Rod has applied his expertise in diverse fields, from communications to professional sports training.
INTRODUCTION xxvii PART I: THE VISUAL STUDIO IDE AND CONTROLS LESSON 1: GETTING STARTED WITH THE VISUAL STUDIO IDE 3 Installing C# 4 Configuring the IDE 6 Building Your First Program 7 Copying Projects 12 Exploring the IDE 13 Try It 16 Lesson Requirements 17 Hints 17 Step-by-Step 17 Exercises 20 LESSON 2: CREATING CONTROLS 21 Understanding Controls 21 Properties 22 Methods 22 Events 22 Creating Controls 23 Setting Control Properties 24 Control Names 26 Popular Properties 27 Modifying Properties in Code 28 Arranging Controls 30 Snap Lines 30 Arrow Keys 31 The Format Menu and Layout Toolbar 31 WPF Controls 32 Try It 32 Lesson Requirements 33 Hints 33 Step-by-Step 33 Exercises 37 LESSON 3: MAKING CONTROLS ARRANGE THEMSELVES 43 Restricting Form Size 44 Using Anchor Properties 44 Using Dock Properties 47 Layout Containers 48 Windows Forms Controls 48 WPF Controls 49 Try It 50 Lesson Requirements 51 Hints 51 Step-by-Step 52 Exercises 52 LESSON 4: HANDLING EVENTS 57 Making Event Handlers 57 Using Event Parameters 59 Setting Scrollbar Properties 60 Tracking Mouse Movement 61 Moving the Mouse Picture 61 Removing Event Handlers 62 Adding and Removing Event Handlers in Code 62 Useful Events 63 Try It 65 Lesson Requirements 65 Hints 65 Step-by-Step 66 Exercises 66 LESSON 5: MAKING MENUS 73 Creating Menus 73 Setting Menu Properties 75 Handling Menu Events 76 Creating Context Menus 77 WPF Menus 78 WPF Context Menus 79 WPF Commanding 79 Try It 80 Lesson Requirements 80 Hints 81 Step-by-Step 81 Exercises 83 LESSON 6: MAKING TOOL STRIPS AND STATUS STRIPS 89 Using Tool Strips 89 Using Tool Strip Containers 91 Using Status Strips 92 Try It 93 Lesson Requirements 93 Hints 95 Step-by-Step 95 Exercises 98 LESSON 7: USING RICHTEXTBOXES 103 Using RichTextBox Properties 103 Giving the User Control 105 Using RichTextBox Methods 106 Using WPF Commands 108 Try It 110 Lesson Requirements 110 Hints 110 Step-by-Step 110 Exercises 112 LESSON 8: USING STANDARD DIALOGS 115 Using Dialogs in General 116 Adding the Dialog to the Form 117 Initializing the Dialog 117 Displaying the Dialog and Checking the Return Result 118 Processing the Results 119 Putting It All Together 120 Using Dialog Properties 120 Using File Filters 123 Using Dialogs in WPF 124 Try It 126 Lesson Requirements 126 Hints 127 Step-by-Step 127 Exercises 130 LESSON 9: CREATING AND DISPLAYING NEW FORMS 133 Adding New Forms 133 Understanding Classes and Instances 134 Displaying Forms 135 Controlling Remote Forms 138 Try It 140 Lesson Requirements 141 Hints 141 Step-by-Step 141 Exercises 143 LESSON 10: BUILDING CUSTOM DIALOGS 147 Making Custom Dialogs 147 Setting the Dialog Result 148 Using Custom Dialogs 149 Try It 150 Lesson Requirements 150 Hints 151 Step-by-Step 151 Exercises 153 PART II: VARIABLES AND CALCULATIONS LESSON 11: USING VARIABLES AND PERFORMING CALCULATIONS 161 What Are Variables? 161 Data Types 161 Float, Double, and Decimal Data Types 163 Declaring Variables 164 Literal Values 165 Type Conversions 167 Casting 168 Converting 169 Parsing 169 Performing Calculations 170 Operands and Operators 171 Promotion 171 Operator Summary 171 Precedence 177 Constants 179 Try It 179 Lesson Requirements 180 Hints 180 Step-by-Step 181 Exercises 182 LESSON 12: DEBUGGING CODE 187 Deferred Techniques 187 Debugging Then and Now 188 Setting Breakpoints 188 Reading Variables 189 Stepping through Code 190 Us