Home Page Icon
Home Page
Table of Contents for
Contents
Close
Contents
by Rod Stephens
C# 24-Hour Trainer, 2nd Edition
Introduction
What's New in the Second Edition
Who This Book Is For
What This Book Covers (And What It Doesn't)
The Wrox 24-Hour Trainer Approach
How This Book Is Structured
What You Need to Use This Book
Conventions
Source Code
Errata
p2p.wrox.com
Section I: The Visual Studio IDE and Controls
Lesson 1: Getting Started with the Visual Studio IDE
Installing C#
Configuring the IDE
Building Your First Program
Copying Projects
Exploring the IDE
Try It
Exercises
Lesson 2: Creating Controls
Understanding Controls
Creating Controls
Setting Control Properties
Arranging Controls
WPF Controls
Try It
Exercises
Lesson 3: Making Controls Arrange Themselves
Restricting Form Size
Using Anchor Properties
Using Dock Properties
Layout Containers
Try It
Exercises
Lesson 4: Handling Events
Making Event Handlers
Using Event Parameters
Removing Event Handlers
Adding and Removing Event Handlers in Code
Useful Events
Try It
Exercises
Lesson 5: Making Menus
Creating Menus
Setting Menu Properties
Handling Menu Events
Creating Context Menus
WPF Menus
WPF Context Menus
WPF Commanding
Try It
Exercises
Lesson 6: Making Tool Strips and Status Strips
Using Tool Strips
Using Tool Strip Containers
Using Status Strips
Try It
Exercises
Lesson 7: Using RichTextBoxes
Using RichTextBox Properties
Giving the User Control
Using RichTextBox Methods
Using WPF Commands
Try It
Exercises
Lesson 8: Using Standard Dialogs
Using Dialogs in General
Using Dialog Properties
Using File Filters
Using Dialogs in WPF
Try It
Exercises
Lesson 9: Creating and Displaying New Forms
Adding New Forms
Understanding Classes and Instances
Displaying Forms
Controlling Remote Forms
Try It
Exercises
Lesson 10: Building Custom Dialogs
Making Custom Dialogs
Setting the Dialog Result
Using Custom Dialogs
Try It
Exercises
Section II: Variables and Calculations
Lesson 11: Using Variables and Performing Calculations
What Are Variables?
Data Types
Declaring Variables
Literal Values
Type Conversions
Performing Calculations
Constants
Try It
Exercises
Lesson 12: Debugging Code
Deferred Techniques
Debugging Then and Now
Setting Breakpoints
Reading Variables
Stepping Through Code
Using Watches
Using the Immediate Window
Try It
Exercises
Lesson 13: Understanding Scope
Scope within a Class
Accessibility
Restricting Scope and Accessibility
Try It
Exercises
Lesson 14: Working with Strings
String Methods
Format and ToString
Try It
Exercises
Lesson 15: Working with Dates and Times
Creating DateTime Variables
Local and UTC Time
DateTime Properties and Methods
TimeSpans
Try It
Exercises
Lesson 16: Using Arrays and Collections
Arrays
Collection Classes
Try It
Exercises
Lesson 17: Using Enumerations and Structures
Enumerations
Structures
Structures Versus Classes
Where to Put Structures
Try It
Exercises
Section III: Program Statements
Lesson 18: Making Choices
Decision Statements
if Statements
if-else Statements
Cascading if Statements
Nested if Statements
Switch Statements
Try It
Exercises
Lesson 19: Repeating Program Steps
for Loops
Foreach Loops
while Loops
do Loops
break and continue
Try It
Exercises
Lesson 20: Reusing Code with Methods
Method Advantages
Method Syntax
Using ref Parameters
Using out Parameters
Try It
Exercises
Lesson 21: Handling Errors
Errors and Exceptions
try-catch Blocks
TryParse
Throwing Exceptions
Try It
Exercises
Lesson 22: Preventing Bugs
Input Assertions
Other Assertions
Try It
Exercises
Section IV: Classes
Lesson 23: Defining Classes
What Is a Class?
Class Benefits
Making a Class
Try It
Methods
Events
Try It
Inheritance
Polymorphism
Try It
Exercises
Lesson 24: Initializing Objects
Initializing Objects
Constructors
Destructors
Invoking Other Constructors
Try It
Exercises
Lesson 25: Fine-Tuning Classes
Overloading Methods
Overriding Methods
Overriding ToString
Try It
Exercises
Lesson 26: Overloading Operators
Overloadable Operators
Unary Operators
Binary Operators
Comparison Operators
Conversion Operators
Try It
Exercises
Lesson 27: Using Interfaces
Interface Advantages
Implementing Interfaces
Defining Interfaces
Try It
Exercises
Lesson 28: Making Generic Classes
Defining Generic Classes
Using Generic Constraints
Making Generic Methods
Try It
Exercises
Section V: System Interactions
Lesson 29: Using Files
Filesystem Classes
Path
Streams
Try It
Exercises
Lesson 30: Printing
Windows Forms Printing
WPF Printing
Printing Visuals
Try It
Exercises
Section VI: Windows Apps
Lesson 31: Windows Store Apps
Navigation Style
App Styles
App Images
Deployment
WPF Techniques
Try It
Exercises
Lesson 32: Windows Phone Apps
Building Apps
Navigation Style
App Styles
App Images
Try It
Exercises
Section VII: Specialized Topics
Lesson 33: Localizing Programs
Understanding Localization
Building Localized Interfaces
Testing Localizations
Processing Locale-Specific Values
Try It
Exercises
Lesson 34: Programming Databases, Part 1
Connecting to a Database
Displaying Data in a Grid
Displaying Data One Record at a Time
Try It
Exercises
Lesson 35: Programming Databases, Part 2
Searching
Filtering
Sorting
Try It
Exercises
Lesson 36: LINQ to Objects
LINQ Basics
where Clauses
Order By Clauses
Select Clauses
Try It
Exercises
Lesson 37: LINQ to SQL
Connecting to the Database
Making LINQ to SQL Classes
Writing Code
Using LINQ Queries
Understanding Nullable Fields
Understanding Query Execution
Using LINQ to SQL with Access
Try It
Exercises
Afterword: What's Next?
End User License Agreement
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Cover
Next
Next Chapter
Introduction
Table of Contents
Introduction
What's New in the Second Edition
Who This Book Is For
What This Book Covers (And What It Doesn't)
The Wrox 24-Hour Trainer Approach
How This Book Is Structured
What You Need to Use This Book
Conventions
Source Code
Errata
p2p.wrox.com
Section I: The Visual Studio IDE and Controls
Lesson 1: Getting Started with the Visual Studio IDE
Installing C#
Configuring the IDE
Building Your First Program
Copying Projects
Exploring the IDE
Try It
Exercises
Lesson 2: Creating Controls
Understanding Controls
Creating Controls
Setting Control Properties
Arranging Controls
WPF Controls
Try It
Exercises
Lesson 3: Making Controls Arrange Themselves
Restricting Form Size
Using Anchor Properties
Using Dock Properties
Layout Containers
Try It
Exercises
Lesson 4: Handling Events
Making Event Handlers
Using Event Parameters
Removing Event Handlers
Adding and Removing Event Handlers in Code
Useful Events
Try It
Exercises
Lesson 5: Making Menus
Creating Menus
Setting Menu Properties
Handling Menu Events
Creating Context Menus
WPF Menus
WPF Context Menus
WPF Commanding
Try It
Exercises
Lesson 6: Making Tool Strips and Status Strips
Using Tool Strips
Using Tool Strip Containers
Using Status Strips
Try It
Exercises
Lesson 7: Using RichTextBoxes
Using RichTextBox Properties
Giving the User Control
Using RichTextBox Methods
Using WPF Commands
Try It
Exercises
Lesson 8: Using Standard Dialogs
Using Dialogs in General
Using Dialog Properties
Using File Filters
Using Dialogs in WPF
Try It
Exercises
Lesson 9: Creating and Displaying New Forms
Adding New Forms
Understanding Classes and Instances
Displaying Forms
Controlling Remote Forms
Try It
Exercises
Lesson 10: Building Custom Dialogs
Making Custom Dialogs
Setting the Dialog Result
Using Custom Dialogs
Try It
Exercises
Section II: Variables and Calculations
Lesson 11: Using Variables and Performing Calculations
What Are Variables?
Data Types
Declaring Variables
Literal Values
Type Conversions
Performing Calculations
Constants
Try It
Exercises
Lesson 12: Debugging Code
Deferred Techniques
Debugging Then and Now
Setting Breakpoints
Reading Variables
Stepping Through Code
Using Watches
Using the Immediate Window
Try It
Exercises
Lesson 13: Understanding Scope
Scope within a Class
Accessibility
Restricting Scope and Accessibility
Try It
Exercises
Lesson 14: Working with Strings
String Methods
Format and ToString
Try It
Exercises
Lesson 15: Working with Dates and Times
Creating DateTime Variables
Local and UTC Time
DateTime Properties and Methods
TimeSpans
Try It
Exercises
Lesson 16: Using Arrays and Collections
Arrays
Collection Classes
Try It
Exercises
Lesson 17: Using Enumerations and Structures
Enumerations
Structures
Structures Versus Classes
Where to Put Structures
Try It
Exercises
Section III: Program Statements
Lesson 18: Making Choices
Decision Statements
if Statements
if-else Statements
Cascading if Statements
Nested if Statements
Switch Statements
Try It
Exercises
Lesson 19: Repeating Program Steps
for Loops
Foreach Loops
while Loops
do Loops
break and continue
Try It
Exercises
Lesson 20: Reusing Code with Methods
Method Advantages
Method Syntax
Using ref Parameters
Using out Parameters
Try It
Exercises
Lesson 21: Handling Errors
Errors and Exceptions
try-catch Blocks
TryParse
Throwing Exceptions
Try It
Exercises
Lesson 22: Preventing Bugs
Input Assertions
Other Assertions
Try It
Exercises
Section IV: Classes
Lesson 23: Defining Classes
What Is a Class?
Class Benefits
Making a Class
Try It
Methods
Events
Try It
Inheritance
Polymorphism
Try It
Exercises
Lesson 24: Initializing Objects
Initializing Objects
Constructors
Destructors
Invoking Other Constructors
Try It
Exercises
Lesson 25: Fine-Tuning Classes
Overloading Methods
Overriding Methods
Overriding ToString
Try It
Exercises
Lesson 26: Overloading Operators
Overloadable Operators
Unary Operators
Binary Operators
Comparison Operators
Conversion Operators
Try It
Exercises
Lesson 27: Using Interfaces
Interface Advantages
Implementing Interfaces
Defining Interfaces
Try It
Exercises
Lesson 28: Making Generic Classes
Defining Generic Classes
Using Generic Constraints
Making Generic Methods
Try It
Exercises
Section V: System Interactions
Lesson 29: Using Files
Filesystem Classes
Path
Streams
Try It
Exercises
Lesson 30: Printing
Windows Forms Printing
WPF Printing
Printing Visuals
Try It
Exercises
Section VI: Windows Apps
Lesson 31: Windows Store Apps
Navigation Style
App Styles
App Images
Deployment
WPF Techniques
Try It
Exercises
Lesson 32: Windows Phone Apps
Building Apps
Navigation Style
App Styles
App Images
Try It
Exercises
Section VII: Specialized Topics
Lesson 33: Localizing Programs
Understanding Localization
Building Localized Interfaces
Testing Localizations
Processing Locale-Specific Values
Try It
Exercises
Lesson 34: Programming Databases, Part 1
Connecting to a Database
Displaying Data in a Grid
Displaying Data One Record at a Time
Try It
Exercises
Lesson 35: Programming Databases, Part 2
Searching
Filtering
Sorting
Try It
Exercises
Lesson 36: LINQ to Objects
LINQ Basics
where Clauses
Order By Clauses
Select Clauses
Try It
Exercises
Lesson 37: LINQ to SQL
Connecting to the Database
Making LINQ to SQL Classes
Writing Code
Using LINQ Queries
Understanding Nullable Fields
Understanding Query Execution
Using LINQ to SQL with Access
Try It
Exercises
Afterword: What's Next?
End User License Agreement
Pages
vii
ix
xi
xxvii
xxviii
xxix
xxx
xxxi
xxxii
xxxiii
xxxiv
xxxv
xxxvi
1
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
43
44
45
46
47
48
49
50
51
52
53
54
55
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
103
104
105
106
107
108
109
110
111
112
113
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
133
134
135
136
137
138
139
140
141
142
143
144
145
147
148
149
150
151
152
153
154
155
156
157
159
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
261
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
313
314
315
316
317
318
319
320
321
323
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
361
362
363
364
365
366
367
368
369
371
372
373
374
375
376
377
378
379
380
381
383
384
385
386
387
388
389
390
391
392
393
394
395
397
398
399
400
401
402
403
404
405
406
407
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
467
468
469
470
471
472
473
474
475
476
477
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
Guide
Cover
Table of Contents
Begin Reading
List of Illustrations
Lesson 1: Getting Started with the Visual Studio IDE
Figure 1.1
Figure 1.2
Figure 1.3
Figure 1.4
Figure 1.5
Figure 1.6
Figure 1.7
Figure 1.8
Lesson 2: Creating Controls
Figure 2.1
Figure 2.2
Figure 2.3
Figure 2.4
Figure 2.5
Figure 2.6
Figure 2.7
Figure 2.8
Figure 2.9
Figure 2.10
Figure 2.11
Figure 2.12
Figure 2.13
Figure 2.14
Figure 2.15
Figure 2.16
Figure 2.17
Lesson 3: Making Controls Arrange Themselves
Figure 3.1
Figure 3.2
Figure 3.3
Figure 3.4
Figure 3.5
Figure 3.6
Figure 3.7
Figure 3.8
Figure 3.9
Figure 3.10
Figure 3.11
Figure 3.12
Lesson 4: Handling Events
Figure 4.1
Figure 4.2
Figure 4.3
Figure 4.4
Figure 4.5
Figure 4.6
Figure 4.7
Figure 4.8
Lesson 5: Making Menus
Figure 5.1
Figure 5.2
Figure 5.3
Figure 5.4
Figure 5.5
Figure 5.6
Figure 5.7
Figure 5.8
Figure 5.9
Figure 5.10
Lesson 6: Making Tool Strips and Status Strips
Figure 6.1
Figure 6.2
Figure 6.3
Figure 6.4
Figure 6.5
Figure 6.6
Figure 6.7
Figure 6.8
Lesson 7: Using RichTextBoxes
Figure 7.1
Figure 7.2
Figure 7.3
Figure 7.4
Figure 7.5
Figure 7.6
Figure 7.7
Lesson 8: Using Standard Dialogs
Figure 8.1
Figure 8.2
Figure 8.3
Figure 8.4
Figure 8.5
Figure 8.6
Lesson 9: Creating and Displaying New Forms
Figure 9.1
Figure 9.2
Figure 9.3
Figure 9.4
Figure 9.5
Figure 9.6
Lesson 10: Building Custom Dialogs
Figure 10.1
Figure 10.2
Figure 10.3
Figure 10.4
Figure 10.5
Figure 10.6
Lesson 11: Using Variables and Performing Calculations
Figure 11.1
Figure 11.2
Figure 11.3
Figure 11.4
Lesson 12: Debugging Code
Figure 12.1
Figure 12.2
Figure 12.3
Figure 12.4
Figure 12.5
Figure 12.6
Figure 12.7
Lesson 13: Understanding Scope
Figure 13.1
Figure 13.2
Figure 13.3
Lesson 14: Working with Strings
Figure 14.1
Lesson 15: Working with Dates and Times
Figure 15.1
Lesson 16: Using Arrays and Collections
Figure 16.1
Figure 16.2
Figure 16.3
Figure 16.4
Figure 16.5
Figure 16.6
Lesson 17: Using Enumerations and Structures
Figure 17.1
Figure 17.2
Figure 17.3
Figure 17.4
Figure 17.5
Lesson 18: Making Choices
Figure 14.1
Figure 18.2
Figure 18.3
Lesson 19: Repeating Program Steps
Figure 19.1
Figure 19.2
Figure 19.3
Lesson 20: Reusing Code with Methods
Figure 20.1
Figure 20.2
Lesson 21: Handling Errors
Figure 21.1
Figure 21.2
Lesson 22: Preventing Bugs
Figure 22.1
Figure 22.2
Figure 22.3
Figure 22.4
Lesson 23: Defining Classes
Figure 23.1
Figure 23.2
Figure 23.3
Lesson 24: Initializing Objects
Figure 24.1
Lesson 25: Fine-Tuning Classes
Figure 25.1
Figure 25.2
Figure 25.3
Lesson 26: Overloading Operators
Figure 26.1
Figure 26.2
Lesson 27: Using Interfaces
Figure 27.1
Figure 27.2
Figure 27.3
Figure 27.4
Figure 27.5
Figure 27.6
Figure 27.7
Lesson 28: Making Generic Classes
Figure 28.1
Figure 28.2
Lesson 29: Using Files
Figure 29.1
Figure 29.2
Lesson 31: Windows Store Apps
Figure 31.1
Figure 31.2
Figure 31.3
Figure 31.4
Lesson 32: Windows Phone Apps
Figure 32.1
Figure 32.2
Figure 32.3
Figure 32.4
Figure 32.5
Figure 32.6
Lesson 33: Localizing Programs
Figure 33.1
Figure 33.2
Figure 33.3
Figure 33.4
Figure 33.5
Figure 33.6
Figure 33.7
Figure 33.8
Lesson 34: Programming Databases, Part 1
Figure 34.1
Figure 34.2
Figure 34.3
Figure 34.4
Figure 34.5
Figure 34.6
Figure 34.7
Figure 34.8
Lesson 35: Programming Databases, Part 2
Figure 35.1
Lesson 36: LINQ to Objects
Figure 36.1
Figure 36.2
Figure 36.3
Lesson 37: LINQ to SQL
Figure 37.1
Figure 37.2
Figure 37.3
Figure 37.4
Figure 37.5
Figure 37.6
Figure 37.7
Figure 37.8
Figure 37.9
List of Tables
Lesson 2: Creating Controls
Table 2.1
Table 2.2
Table 2.3
Lesson 3: Making Controls Arrange Themselves
Table 3.1
Lesson 4: Handling Events
Table 4.1
Lesson 5: Making Menus
Table 5.1
Lesson 7: Using RichTextBoxes
Table 7.1
Table 7.2
Table 7.3
Table 7.4
Lesson 8: Using Standard Dialogs
Table 8.1
Table 8.2
Table 8.3
Table 8.4
Table 8.5
Table 8.6
Table 8.7
Table 8.8
Lesson 11: Using Variables and Performing Calculations
Table 11.1
Table 11.2
Table 11.3
Table 11.4
Table 11.5
Table 11.6
Table 11.7
Table 11.8
Table 11.9
Lesson 13: Understanding Scope
Table 13.1
Lesson 14: Working with Strings
Table 14.1
Table 14.2
Table 14.3
Table 14.4
Table 14.5
Table 14.6
Table 14.7
Table 14.8
Lesson 15: Working with Dates and Times
Table 15.1
Table 15.2
Table 15.3
Lesson 16: Using Arrays and Collections
Table 16.1
Table 16.2
Table 16.3
Table 16.4
Lesson 26: Overloading Operators
Table 26.1
Lesson 29: Using Files
Table 29.1
Table 29.2
Table 29.3
Table 29.4
Table 29.5
Table 29.6
Table 29.7
Table 29.8
Lesson 31: Windows Store Apps
Table 31.1
Lesson 32: Windows Phone Apps
Table 32.1
Lesson 35: Programming Databases, Part 2
Table 35.1
Table 35.2
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset