|
|
 |

 |
|
Microsoft® Visual C#® .NET Deluxe Learning Edition-Version 2003
|
|
|
Author
|
|
Microsoft Corporation
|
|
|
Pages
|
672
|
|
Disk
|
6 Companion CD(s)
|
|
Level
|
Beg/Int
|
|
Published
|
05/07/2003
|
|
ISBN
|
9780735619104
|
|
Price
|
$119.99
To see this book's discounted price, select a reseller below.
|
|
|
|
|
 |
|
|
Index
Symbols and Numbers
& (ampersand) character in menus, 343
& (AND) bitwise operator, 267
&& (AND) Boolean operator, 61
~ (bitwise) operator, 266
{ } (braces or curly brackets), 39
= = (decrement) operator, 41, 74, 307-308
++ (increment) operator, 41, 74, 307-308
<< (left-shift) operator, 266
+= operator, 291
- = operator, 292
| (OR) bitwise operator, 267
|| (OR) Boolean operator, 61
>> (right-shift) operator, 266
( ) (round brackets), 39
[ ] (square brackets), 39
^ (XOR) bitwise operator, 267
A
abstract classes, 217-219
abstract data types, 118
accessibility, 117, 126
accessing
ASP.NET services, 541
data with Web Forms, 535
databases, 439-448
individual array elements, 174
static fields, 134
accessors, 252, 269
Active Server Pages (ASPs), 504
ActiveMdiChild property, 412
Add button, 336-337
adding
code to save database changes, 446-448
controls to forms, 327-335, 339
controls to Toolbox, 433
ErrorProvider controls, 366-368
HTML controls to Web Forms, 523
implicit conversion operators, 314-315
ListView controls, 386-388
Login user controls to Toolbox, 423-424
menu items to menus, 354
menus, 342-350
navigation buttons to DataGrid controls, 570-572
Panel controls, 376
RangeValidator controls, 529-530
references to XML Web services, 599-600
RequiredFieldValidator controls, 527-529
SaveFileDialog controls, 409-410
Server controls to Web Forms, 523
shortcut keys to menu items, 355
Splitter controls, 375
ToggleButton user controls to Toolbox, 431-433
ValidationSummary controls, 530-532
XML comments to code, 14
ADO.NET
closing connections, 454
connecting to databases, 449
disconnecting from databases, 453
overview, 437
querying data, 450-451, 541
quick reference, 456
using programmatically, 448-456
AfterSelect event, 396
AllowSorting property, 576
Alt key, 343
ambient properties, 426
ampersand (&) character in menus, 343
Analyze class, 494
anchoring controls, 395
AND (&) bitwise operator, 267
AND (&&) Boolean operator, 61
anonymous access, 602-603
application modal dialog boxes, 407
application-centered model, 404
Application.Exit method, 350
applications
Application.Exit method, 350
building console, 9-10
building MDI, 398-404
client vs. server, 503
Close method, 350
compiling, 323-324, 334
creating, 320-324, 339, 469, 537
creating console, 4-7
creating Windows Forms, 18-25
displaying data in Windows Forms, 442-446
running, 55
running console, 9-10
running Windows, 25
server vs. client, 503
testing, 334
timesheet analysis, 494-497
timesheet recording, 490-493
Web. See Web applications
Windows Forms database connections, 456
writing first, 7-11
arithmetic operators. See operators
ArrayList class, 180-182
arrays. See also collections
accessing individual elements, 174
arguments, 194
ArrayList class, 180-182
card playing exercise, 186-191
compared to collections, 186
compared to indexers, 271
copying, 176-178
creating instances, 172
declaring variables, 171
deep vs. shallow copy, 177
initializing variables, 173
iterating through all elements, 175
multidimensional, 173
naming convention, 183
overview, 171
param object, 198
parameter. See parameter arrays
quick reference, 191-192
System.Array class, 178
termination conditions, 175
ASP.NET
accessing, 541
adding Server controls to Web Forms, 523
.aspx files, 505
building Web applications, 505-514, 559
caching, 548, 557
Cookie Protocol, 503
creating Web applications, 505, 523, 563-570
creating Web Forms styles, 523
directives, 505
editing definitions of Web Forms, 523
event handlers, 515-518, 523
event processing, 522
features, 504
Forms-based security, 537
Global.asax, 506
HTML controls, 515, 523
Internet as infrastructure, 502-505
overview, 501, 504
quick reference, 523, 576-577
round-trips, 522
runat attribute, 515
security, 541
Server controls, 514-515, 523
sorting DataGrid controls, 560-563
tags, 505
testing Web Forms, 514, 518-521
validation controls, 525-533
viewing definitions of Web Forms, 523
viewing HTML source code for Web Forms, 523
Web Form layouts, 506-513
Web server requests and responses, 502
Web Sharing, 505
World Wide Web Publishing Service, 505
ASP.NET Web Application template, 523
ASP.NET Web Service template, 584
ASPs (Active Server Pages), 504
.aspx files, 505
assignment operator, 60
associativity
Boolean operators, 62
evaluating expressions using, 40
overview, 302
asynchronously executing Web methods, 604-607
asynchronously invoking Web methods, 605, 607
attaching delegates to events, 298
authentication, 602-603
AutoClosing, 239
B
base class constructors, 209, 229
base classes, 208
base keyword, 209
binary operators, 60, 266, 302
binding. See data binding
bitwise operators
~, 266
AND (&), 267
OR (|), 267
overview, 266
XOR (^), 267
BlinkStyle property, 366
blocks
finally, 109, 237
grouping statements, 64
try, 94, 97-99
bool variables, 59
Boolean expressions, 59, 63
Boolean operators
AND (&&), 61
assignment, 60
associativity, 62
equality, 60
inequality, 60
logical, 61
OR (||), 61
overview, 60
precedence, 62
quick reference, 72
relational, 60
short circuiting, 61
boxing, 146, 151
braces, 39
break statements, 70, 80
Browsable (false) attribute, 433
browsing database table information, 441-442, 456
building
ASP.NET applications, 505-514, 559
console applications, 9-10
login forms, 537-540, 556
Login user controls, 416-423
MDI applications, 398-404
timesheet recording applications, 490-493
XML Web services, 579, 584
built-in conversions, 312
C
C or C++ pointers, 148
C# Method Wizard, 51-54
Cache object, 549, 557
caching, 548, 557
calling
base class constructors, 209, 229
class methods, 134
constructors, 119, 133
delegates, 285-286, 297
destructors, 245
disposal methods, 240-242
events, 292
indexers, 276
instance methods, 126-128
methods, 47-48, 55
params array methods, 203-204
quick reference, 133-134
static methods, 131-133
struct constructors, 162-163
camelCase, 126
cascading if statements, 64-67
case-sensitive identifiers, 28
catch handlers
general vs. specialist, 96
multiple, 95
overview, 95
writing, 96-99, 108-109
writing try/catch statements, 97-99
CausesValidation property, 358, 369
chaining delegates, 292
changing control properties, 22-24, 332-335, 339
CheckBox control
initializing, 333, 339
ThreeState property, 328
checked expressions, 101-104
checked integer arithmetic. See integer arithmetic
checked keywords, 100
checked statements, 100
CheckedListBox control, 465
Circle class, 116-121, 130, 135
Class Library template, 427
class methods, 130, 134
Class template, 590
class types, 135-139
classes
abstract, 217-219
accessibility, 117, 126
Analyze, 494
ArrayList, 180-182
base, 208
Circle, 116-121, 130, 135
classification, 115
collection, 179-182
ColorSyntaxVisitor, 223
compared to struct types, 158-160, 309
Console, 200
Control, 415
creating, 115
creating class scope, 49
DataAdapter, 437
DataSet, 437, 456
declaring, 133
defining, 590-593
derived, 208, 229
encapsulation, 116
inheritance, 145, 208
instances of, 120
Object, 144-145
Queue, 182
sealed, 220
SortedList, 184
SqlDataReader, 453
Stack, 183
System.Data.DataSet, 470
System.Delegate, 284
System.Object, 144-145, 208
XmlDocument, 483
classification, 115
Clear button, 335-336
Click event
Add button, 336-337
Clear button, 335-336
menus, 355
override, 430
client vs. server applications, 503
client vs. server validations, 525-527
Close method, 350
closing
database connections, 454
MDI child forms, 404
Closing event, 337-338
CLR (common language runtime), 306
CLS (Common Language Specification), 30, 118, 306
collections. See also arrays
ArrayList class, 180-182
card playing exercise, 186-191
compared to arrays, 186
FIFO (first-in first-out), 182
LIFO (last-in first-out), 183
naming convention, 183
overview of classes, 179-180
Queue class, 182
quick reference, 191-192
SortedList class, 184
Stack class, 183
ColorSyntaxVisitor class, 223
Column templates, 563-568, 576
ComboBox control
complex data binding, 465
populating, 332, 339
common dialog controls, 409-411
common language runtime (CLR), 306
Common Language Specification (CLS), 30, 118, 306
CompareValidator control, 527
compiler-generated constructors, 120
compiling applications, 323-324, 334
complex controls, 371
complex data binding, 464-468, 477
compound assignment operators, 73, 306
configuring
applications to use Forms-based security, 540-541
data sources, 465-466
connecting databases, 439-441, 449-450, 457
connection pooling, 454
Console class, 200
const fields, 134
const keyword, 130
constructors
calling, 119, 133
calling base class, 209, 229
compiler-generated, 120
declaring, 133
naming, 126
overloading, 121
overview, 119
struct variables, 162-163
writing, 122-126
consuming Web services, 597, 599-603
continue statements, 80
Control class, 415
control properties, 22-24
controls
adding to forms, 327-335, 339
adding to Toolbox, 433
anchoring, 395
CheckBox, 328, 333
CheckedListBox, 465
ComboBox, 332, 465
common dialog, 409-411
complex, 371
DataGrid. See DataGrid control
DataList, 576
DateTimePicker, 328, 333
Dock property, 373-375, 395
ErrorProvider, 366-369
events, 339
GroupBox, 333
HTML, 515, 523
ImageButton, 571
ImageList, 380
ListBox, 333, 467-468
MainMenu. See menus
moving in Toolbox, 434
navigating data, 377
Panel, 376, 395
pop-up menus, 355
properties, 329-335, 339
quick reference, 395
RadioButton, 333
Repeater, 575
SaveFileDialog, 409-411, 413
Server. See Server controls
Splitter. See Splitter control
TextBox, 461
ToggleButton, 427-433
TreeView. See TreeView control
user. See user controls
validation, 525-533
Windows Forms, 327
conversion operators
built-in conversions, 312
declaring, 312-313, 316
explicit, 312
implicit, 312, 314-315
narrowing conversions, 312
OverflowException, 312
user-defined, 312-313
widening conversions, 312
writing, 314-315
conversions
built-in, 312
overview, 312
types, 197
Cookie Protocol, 503
copying
arrays, 176-178
struct variables, 163-164
value type and reference type variables, 135-139, 150
creating
applications, 469, 537
array instances, 172
ASP.NET Web applications, 563-570
class scope with classes, 49
classes, 115
console applications, 4-7
data sources, 465-466
database connections, 456
delegate instances, 286-290, 297
derived classes, 229
dialog boxes, 405-407
disconnected DataSets, 468-472, 478
docked controls, 373-374
documentation using XML and comments, 14-18
enumeration types, 156-157
event handlers, 517, 523
forms, 465
GUI components, 415
interfaces, 214
local scope with methods, 49
Login user control test applications, 424-426
Login user controls, 417-418
MDI child forms, 400-401
MDI parent forms, 398-400
menu separator bars, 354
menus, 342-344, 354
MiddleShire Bell Ringers Association project, 320
objects, 115, 122-126, 232
out parameters, 141
overloaded methods, 193
pop-up menus, 350-355
ref parameters, 140
Reset method, 332
shared fields, 129
static fields, 130
struct types, 165-168
symmetric operators, 304-306, 313-314
timesheet analysis applications, 494-497
ToggleButton user controls, 427-428
user controls, 433
user interfaces, 19-22
values, 164
Web applications, 505, 523
Web Forms, 572-574
Web Forms styles, 523
Web methods, 593-595
Web service client applications, 599, 604-605
Windows Forms applications, 18-25, 320-324, 339
Windows projects, 19
XML files, 498
XML schemas, 484-490, 498
XML Web services, 584-588, 596
curly brackets { }, 39
cursors, 453
CustomValidator control, 527
D
Data Adapter Configuration Wizard, 465, 477, 543
data binding
binding ListBox controls to DataSets, 467-468
binding to columns in DataSets, 462-464
binding to Text property of TextBox controls, 461
complex, 464-468, 477
creating forms, 465
DataGrid controls, 561, 564
quick reference, 477
simple, 460-464, 477
Windows Forms, 460-468
Data Link Wizard, 456
data sources
complex data binding, 477
configuring, 465-466
creating, 465-466
simple data binding, 477
data types, abstract, 118
DataAdapter class, 437
databases
accessing, 439-448
adding code to save changes, 446-448
ADO.NET. See ADO.NET
browsing table information, 441-442, 456
closing connections, 454
connecting, 439-441, 449-450, 457
connections in Windows Forms, 456
creating connections, 456
creating disconnected DataSets, 468-472
disconnecting, 453
displaying data, 442
fetching data, 457
multi-user, 447
Northwind Traders database overview, 438
querying tables, 450-451, 457
quick reference, 456
updating, 475-476, 478, 554-556
DataBindings property, 477
DataGrid control
adding navigation buttons, 570-572
AllowSorting property, 576
binding, 561, 564
Column templates, 563-568, 576
deleting rows of data, 550-553, 557
displaying columns as check boxes, 565-567
displaying data, 542-546
editing data, 550-557
overview, 535
paging, 546, 557
populating, 545-546, 557
quick reference, 576-577
reorganizing columns, 567-568
Sort property, 563
SortCommand event, 562
sorting, 560-563
styles, 545
updating databases, 554-556
updating rows of data, 553-557
DataGridCommandEventsArgs object, 572
DataList control, 576
DataSets
binding ListBox controls, 467-468
binding to columns, 462-464
disconnected. See disconnected DataSets
displaying data, 456
GetChanges method, 472
integrity rules, 475
overview, 437
quick reference, 477
RejectChanges method, 472
retrieving large, 473
simple data binding, 462-464
types, 470
update events, 476
DataView object, 562
DateTimePicker control, 328, 333
Debug menu, 588
debugger
not starting automatically, 97
starting automatically, 107
stepping through methods, 55-57
decision statements
bool variables, 59
Boolean operators. See Boolean operators
if statements, 62-67
overview, 59
quick reference, 72
switch statements, 67-72
declaring
array variables, 171
class methods, 134
classes, 133
const fields, 134
constructors, 133
conversion operators, 312-313, 316
decrement (= =) operator, 307-308
delegates, 281, 284, 297
enumeration types, 154, 169
enumeration variables, 169
events, 291, 297
increment (++) operator, 307-308
indexers, 268
interface indexers, 272, 279
interface properties, 257-258, 263
interfaces, 229
methods, 43-47
operators, 304, 316
params arrays, 195-197
quick reference, 133-134, 169
read-only indexers, 278
read-only properties, 263
read/write indexers, 278
read/write properties, 262
static fields, 134
struct types, 158, 169
struct variables, 160, 169
variables, 30
virtual methods, 229
write-only indexers, 278
write-only properties, 263
decrement (= =) operator, 41, 74, 307-308
decrementing variables, 40, 74
defining
classes, 590-593
Web methods, 586-587
XML schemas, 484-488
Definite Assignment Rule, 31
delegate keyword, 284, 297
delegates
attaching to events, 298
calling, 285-286, 297
chaining, 292
creating instances, 286-290, 297
declaring, 281, 284, 297
detaching from events, 298
examples, 281-284
overview, 281
quick reference, 297
reference types, 285
static methods, 288-290
unchaining, 292
using, 288
Windows Forms events, 338
derived classes, 208, 229
Desktop Engine, 438
destructors
calling, 245
calling disposal methods, 240-242
Finalize method, 233
objects, 232
overview, 232
quick reference, 245
restrictions, 233
writing, 233, 245
detaching delegates from events, 298
dialog boxes
application modal, 407
creating, 405-407
MDI, 405-408
modal and modeless, 405-408, 412
system modal, 407
direct types, 135
directives, 505
disabling
client validation, 530
menu items, 355
disconnected DataSets
creating, 468-472, 478
overview, 468
updating, 472-476
updating databases, 478
validating changes, 472-474, 478
disconnecting databases, 453
displaying
data in DataGrid controls, 542-546
data in Windows Forms applications, 442-446
DataGrid control columns as check boxes, 565-567
dialog boxes, 412
iteration statements, 78
MDI child forms, 401, 412
primitive data type values, 32-35
disposal methods, 236-237, 240-242, 245
do statements, 77, 84-90
Dock property, 373-375, 395
Document Object Model (DOM), 483
document type definitions (DTDs), 483
document-centered model, 404
DOM (Document Object Model), 483
DTDs (document type definitions), 483
dynamic HTML, 532
E
editing data, 550-557
EII (Explicit Interface Implementation), 226
enabling
menu items, 355
notifications with events, 290
encapsulation, 116
enum keyword, 153
enumeration types
creating, 156-157
creating values, 164
declaring, 154, 169
default type, 154
list of types, 155
overview, 155
using, 156-157
enumeration variables
assigning values, 169
declaring, 169
definite assignment rules, 155
initializing, 169
enumerations
literal values, 154
overview, 153
quick reference, 169
using, 155-157
equality operator, 60
ErrorProvider control, 366-369
errors. See also exceptions
error-handling vs. main code, 94
global variables for method failures, 93
-94
overview, 93
quick reference, 111
validation, 532-533
event handlers
valHandler method, 494
ValidationEventHandler, 495, 498
writing, 515-518
event keyword, 291
events
+= operator, 291
- = operator, 292
AfterSelect, 396
attaching delegates, 298
calling, 292
Click. See Click event
controls, 339
DataSet update, 476
declaring, 291, 297
delegates for Windows Forms, 338
detaching delegates, 298
enabling notifications, 290
event handlers. See event handlers
extending, 434
FillError, 473
forms, 339
GUI, 293-295
Login user controls, 421-423
menus, 342-350
override, 434
pop-up menus, 355
processing in Web Forms, 522
processing in Windows Forms, 335
publishing in Windows Forms, 335
quick reference, 297
raising, 299
SortCommand, 562
subscribing to, 291
TextChanged, 526
TreeView control, 381-386
unsubscribing from, 292
using, 295-296
Validating, 525
validation, 358, 369
exceptions. See also errors
catch handlers overview, 95
described, 94
error handling vs. main code, 94
finally blocks, 109
floating point (non-integer) arithmetic, 101
general vs. specialist catch handlers, 96
integer arithmetic overview, 100
multiple catch handlers, 95
quick reference, 111
safe disposal, 237
throwing, 104-109
try blocks overview, 94
writing catch handlers, 96-99, 108-109
writing checked expressions, 101-104
writing checked statements, 100
writing safe code, 242-244
writing throw statements, 105-107
writing try/catch statements, 97-99
writing unchecked statements, 101
exception-safe code, 242-244
exception-safe disposal, 237
executing Web methods, 600, 604-607
explicit conversion operators, 312
explicit conversions, 198
Explicit Interface Implementation (EII), 226
Explorer, 371-373
expressions
Boolean, 59, 63
evaluating using associativity, 40
overview, 27
quick reference, 42
extending
events, 434
inheritance hierarchies, 220-225
.NET Framework control classes, 434
Extensible Markup Language. See XML
F
fetching
data, 457
data pages, 547
fields
compared to methods, 249-251
const, 134
instance, 130
shared, 129
static, 130, 134
FIFO (first-in first-out) collection, 182
Fill method, 473
FillError event, 473
Finalize method, 233
finally blocks, 109, 237
firehose cursors, 453
first-in first-out (FIFO) collection, 182
floating point (non-integer) arithmetic, 101
for statements, 76-77, 79
forms
adding controls, 327-335, 339
Application.Exit method, 350
Close method, 350
creating, 465
events, 339
MainMenu controls, 354
menus, 354
pop-up menus, 355
properties, 339
resizing, 24
security, 536-541, 556
setting properties, 321-322
Web. See Web Forms
Windows. See Windows Forms
Forms-based security
building login forms, 537-540, 556
configuring applications to use, 540-541
implementing, 537-541
overview, 536
free format language, 28
G
garbage collection, 231-236, 245
get accessors, 252, 269
GetChanges method, 472
Global.asax, 506
GroupBox control, 333
grouping if statements inside blocks, 64
GUI components
creating, 415
Login user controls, 416-426
quick reference, 433-434
specializing controls using subclassing, 426-433
ToggleButton user controls, 427-433
user controls, 415-426
GUI events, 293-295
H
heap memory, 143-144
HTML controls, 515, 523
HTML View, 509, 523, 576
I
icons, IntelliSense, 9
identifiers. See also keywords
camelCase, 126
case-sensitive, 28
naming schemes, 126
overloading, 50
overview, 28
PascalCase, 126
IDisposal interface, 238-240
if statements
Boolean expressions, 63
cascading, 64-67
grouping statements inside blocks, 64
overview, 62
quick reference, 72
syntax, 63
writing, 65-67
IIOP (Internet Inter-ORB Protocol), 580
ImageButton control, 571
ImageList control, 380
implementing
client validation, 527-532
Forms-based security, 537-541
interface indexers, 279
interface properties, 263
interfaces, 216, 230
operator constraints, 302
operators, 309
properties to access attributes, 249
implicit conversion operators, 314-315
implicit conversions, 197, 312
increment (++) operator, 41, 74, 307-308
incrementing variables, 40, 74
indexers
calling, 276
compared to arrays, 271
compared to methods, 271
compared to properties, 272
declaring, 268
examples, 265-269
get accessors, 269
interfaces, 272, 279
overview, 265
quick reference, 278-279
read-only, 270, 278
read/write, 269, 278
set accessors, 269
syntax, 268
Windows applications, 273-277
write-only, 270, 278
writing, 274
indirect types, 135
inequality operator, 60
inheritance
abstract classes, 217-219
classes, 208
creating interfaces, 214
Explicit Interface Implementation (EII), 226
extending hierarchies, 220-225
implementing interfaces, 216
interface restrictions, 215
interface syntax, 215
keyword combination list, 228
multiple interfaces, 226-228
overview, 207
quick reference, 229
sealed classes, 220
sealed methods, 220
syntax, 208-214
System.Object class, 145, 208
writing ColorSyntaxVisitor class, 223
initializing
array variables, 173
CheckBox controls, 339
enumeration variables, 169
RadioButton controls, 339
struct variables, 169
instance fields, 130
instance methods, 126-129
instance variables, 130
int type, 265
int variable, 135-139
IntBits struct, 267
integer arithmetic
checked keywords, 100
overview, 100
unchecked keywords, 101
writing checked statements, 100
writing unchecked statements, 101
integrity rules, 475
IntelliSense
icons, 9
overview, 7
interfaces
creating, 214
declaring, 229
Explicit Interface Implementation (EII), 226
IDisposal, 238-240
implementing, 216, 230
indexers, 272, 279
multiple, 226-228
properties, 257-258, 263
restrictions, 215
syntax, 215, 226
Internet
infrastructure, 502-505
Web server requests and responses, 502
Internet Inter-ORB Protocol (IIOP), 580
introduction, 3
invoking Web methods, 605, 607
IsCompleted property, 607
IsMDIContainer property, 412
iteration statements
arrays, 175
break statements, 80
compound assignment operators, 73
continue statements, 80
displaying, 78
do statements, 77, 84-90
for statements, 76-77, 79
overview, 73
quick reference, 91
while statements, 75, 79-84
K
keywords
base, 209
const, 130
delegate, 284, 297
enum, 153
event, 291
list of, 28-29
list of combinations, 228
new, 119-128, 211
object, 145
operator, 303
override, 212
overview, 28
params, 194-195
protected, 213
static, 129
struct, 157
type equivalences, 164-165
virtual, 212
L
last-in first-out (LIFO) collection, 183
left-shift (<<) operator, 266
LIFO (last-in first-out) collection, 183
ListBox control
data binding, 467-468
populating, 333, 339
ListView control
adding, 386-388
displaying object list, 396
TreeView controls, 388-394
local scope, 49
logical operators, 61
login forms, 537-540, 556
Login user control
adding to Toolbox, 423-424
building, 416-423
creating, 417-418
creating test applications, 424-426
defining properties, 419-421
exposing events, 421-423
quick reference, 433-434
using, 423-426
validating data, 421-423
longhand names, 13
M
Main method
parameter arrays, 204-205
quick reference, 206
XML files, 494
MainMenu control. See menus
MDI (multiple document interface)
ActiveMdiChild property, 412
alternatives, 404
arranging child forms, 412
building applications, 398-404
closing child forms, 404
common dialog controls, 409-411
creating child forms, 400-401
creating parent forms, 398-400
dialog boxes, 405-408, 412
displaying child forms, 401, 412
IsMDIContainer property, 412
menus, 412
overview, 398
quick reference, 412
SaveFileDialog controls, 409-411, 413
toolbars, 403
Window menus, 412
members, static, 131-133
memory, 143-144
menus
& (ampersand) character, 343
adding, 342-350
adding menu items, 354
adding to forms, 354
additional information, 342
Alt key, 343
Application.Exit method, 350
applications, 350
Click events, 355
creating, 342-344, 354
Debug, 588
disabling menu items, 355
enabling menu items, 355
events, 342-350
forms, 350
guidelines, 342
MDI, 412
overview, 341
pop-up. See pop-up menus
properties, 344-348
quick reference, 354
separator bars, 354
shortcut keys, 345, 355
testing, 347
methods
Application.Exit, 350
calling, 47-48, 55
class, 130
Close, 350
compared to fields, 249-251
compared to indexers, 271
creating local scope, 49
creating overloaded, 193
creating Web, 593-595
declaring, 43-47
defining Web, 586-587
disposal, 236-237, 240-242, 245
executing Web, 600, 604-607
Explicit Interface Implementation (EII), 226
Fill, 473
Finalize, 233
GetChanges, 472
instance, 126-129
invoking Web, 605, 607
Main, 204-206, 494
monitoring execution of Web, 607
new, 210
OnClick, 430
override, 212, 430
overview, 43
params array, 200-204
quick reference, 58
RejectChanges, 472
Reset, 332, 334
sealed, 220
Server.Transfer, 577
SetError, 368
static, 128-133, 288-290
stepping through using debugger, 55-57
syntax, 44, 47
testing Web, 587-588
Update, 476
valHandler, 494
virtual, 211, 229
WriteLine, 193, 200
WriteStartDocument, 498
writing, 51-54
Microsoft ADO.NET. See ADO.NET
Microsoft ASP.NET. See ASP.NET
Microsoft SQL Server 2000, 438
Microsoft SQL Server 2000 Desktop Engine, 438
Microsoft Visual Studio .NET debugger. See debugger
Microsoft Windows Forms. See Windows Forms
MiddleShire Bell Ringers Association project, 320
modal and modeless dialog boxes, 405-408
monitoring execution of Web methods, 607
multidimensional arrays, 173
multiple catch handlers, 95
multiple document interface (MDI). See MDI
multiple interfaces, 226-228
multi-user databases, 447
N
namespaces
overview, 11-14
System, 144-145
System.Collections, 179
System.Drawing, 427
System.IO, 494
System.Web, 516
System.Windows.Forms, 415, 427
System.Xml, 483, 494
System.Xml.Schema, 494
XML Web services, 585
naming schemes, 126
naming variables, 29
narrowing conversions, 312
NavigateUrl property, 577
.NET Framework class library, 483
.NET Framework control classes, 434
new keyword, 119-128, 211
new methods, 210
no fall-through rule, 70
non-integer (floating point) arithmetic, 101
Northwind Traders database. See databases
notifications, enabling with events, 290
O
Object class, 144-145
object keyword, 145
objects
Cache, 549, 557
compared to values, 120, 231
creating, 115, 122-126, 232
DataGridCommandEventsArgs, 572
DataView, 562
destructors, 232
param object arrays, 198
SqlConnection, 457, 473
SqlDataAdapter, 456, 477
SqlDataReader, 457
TreeNode, 382
unreachable, 235
XmlTextReader, 494, 498
XmlTextWriter, 498
OK button, 24
OnClick method, 430
operator keyword, 303
operators
- =, 292
+=, 291
assignment, 60
binary, 60, 266, 302
bitwise. See bitwise operators
Boolean. See Boolean operators
code examples, 36-38
common language runtime (CLR), 306
Common Language Specification (CLS), 306
compound assignment, 73-74, 306
controlling precedence, 39
conversion. See conversion operators
declaring, 304, 316
decrement (= =), 41, 74, 307-308
evaluating expressions using associativity, 40
implementing, 309
implementing constraints, 302
increment (++), 41, 74, 307-308
overloading, 301, 303-304, 310-311
overview, 27, 35, 301
pairs, 308
postfix, 41, 307
precedence, 39
prefix, 41, 307
quick reference, 42, 316
shift, 266
operators
symmetric. See symmetric operators
unary, 60, 266, 302
value types, 35
writing operator+ overloads, 310-311
optimizing data access, 548-550
OR (|) bitwise operator, 267
OR (||) Boolean operator, 61
out parameters, 139-143, 151
OverflowException, 312
overloading
constructors, 121
identifiers, 50
methods, 193
operators, 301, 303-304, 310-311
override Click event, 430
override events, 434
override keyword, 212
override methods, 212, 430
overview, 3
P
paging, 546, 557
Panel control, 376, 395
parameter arrays
arguments, 194
calling methods, 203-204
Console.WriteLine, 200
creating overloaded methods, 193
declaring, 195-197
Main method, 204-205
overview, 193
params object, 198
quick reference, 206
type conversions, 197
writing methods, 200-203
parameters
out, 139-143, 151
ref, 139-143, 150
reference, 137-139
value, 137-139
params keyword, 194-195
params object arrays, 198
parentheses ( ), 39
PascalCase, 126
pi variable, 149
pointers, 148
polymorphism, 211
pooling connections, 454
populating
ComboBox controls, 332, 339
DataGrid controls, 545-546, 557
ListBox controls, 333, 339
pop-up menus
controls, 355
creating, 350-355
events, 355
forms, 355
SourceControl property, 355
postfix form of operators, 41, 307
precedence
Boolean operators, 62
controlling for operators, 39
overview, 301
prefix form of operators, 41, 307
preprocessor directives, 327
primitive data types
bool, 60
code examples, 33-35
displaying values, 32-35
instances of, 120
list of, 31-32
overview, 27, 31
value types, 135-139
processing
events in Windows Forms, 335
menu events, 342-350
Web Forms events, 522
programming. See also writing
overview, 4-7
quick reference, 26
programs. See applications
properties
ActiveMdiChild, 412
AllowSorting, 576
ambient, 426
BlinkStyle, 366
CausesValidation, 358, 369
changing programmatically, 326-327
compared to indexers, 272
controls, 22-24, 329-335, 339
DataBindings, 477
Dock, 373-375, 395
forms, 321-322, 339
get accessors, 252
implementing to access attributes, 249
interfaces, 257-258, 263
IsCompleted, 607
IsMDIContainer, 412
list of Windows Forms, 324-326
menus, 344-348
NavigateUrl, 577
overview, 251
quick reference, 262-264
read-only, 253, 263
read/write, 253, 262
restrictions, 254
set accessors, 252
Sort, 563
SourceControl, 355
State, 473
static, 255
structification, 256
targetSchema, 498
Text, 461
ThreeState, 328
ToggleButton user controls, 428-430
user controls, 419-421
Windows applications, using in, 258-262
write-only, 254, 263
protected access, 213
protected keyword, 213
protocols
Cookie Protocol, 503
IIOP (Internet Inter-ORB Protocol), 580
RMI (Remote Method Invocation), 580
SOAP (Simple Object Access Protocol), 483, 581-582, 589, 597-598
XML, 483
proxies, 597, 607
publishing events in Windows Forms, 335
Q
Query Builder, 466
querying
data, 541-550
database tables, 450-451, 457
Queue class, 182
quick reference
ADO.NET, 456
arrays, 191-192
ASP.NET, 523, 576-577
Boolean operators, 72
boxing, 151
calling, 133-134
collections, 191-192
complex controls, 395
copying value type and reference type variables, 150
data binding, 477
databases, 456
DataGrid controls, 576-577
DataSets, 477
decision statements, 72
declarations, 133-134, 169
delegates, 297
destructors, 245
disposal methods, 245
enumerations, 169
errors, 111
events, 297
exceptions, 111
expressions, 42
garbage collection, 245
GUI components, 433-434
if statements, 72
indexers, 278-279
inheritance, 229
iteration statements, 91
Login user controls, 433-434
Main method, 206
MDI, 412
menus, 354
methods, 58
operators, 42, 316
out parameters, 151
parameter arrays, 206
programming overview, 26
properties, 262-264
ref parameters, 150
resource management, 245
scope, 58
struct types, 169
switch statements, 72
ToggleButton user controls, 433-434
unboxing, 151
using statements, 246
validation, 369, 533
variables, 42
Web applications, 577
Web Forms, 556
Windows Forms, 339
XML, 498
XML Web services, 596, 607, 610
R
RadioButton control, 333, 339
raising events, 299
RangeValidator control, 527, 529-530, 533
read-only indexers, 270, 278
read-only properties, 253, 263
read/write indexers, 269, 278
read/write properties, 253, 262
ref parameters, 139-143, 150
reference parameters, 137-139
reference types, 135-139, 150, 285
#region, 327
RegularExpressionValidator control, 527
RejectChanges method, 472
relational operators, 60
Remote Method Invocation (RMI), 580
Repeater control, 575
RequiredFieldValidator control, 526-529, 533
Reset method, 332, 334
resizing forms, 24
resource management
AutoClosing, 239
disposal methods, 236-237, 240-242, 245
exception-safe code, 242-244
exception-safe disposal, 237
IDisposal interface, 238-240
overview, 236
quick reference, 245
using statements, 238, 242-244, 246
retrieving
data on demand, 546-548, 557
large DataSets, 473
return statements, 45-47
right-shift (>>) operator, 266
RMI (Remote Method Invocation), 580
round brackets ( ), 39
round-trips, 522
runat attribute, 515
running
applications, 55
console applications, 9-10
Windows applications, 25
S
SaveFileDialog control, 409-411, 413
saving data as XML, 491-493
SAX (Simple API for XML), 483
schemas
targetSchema property, 498
XML, 481, 484-490, 498
scope
creating class scope with classes, 49
creating local scope with methods, 49
for statements, 77
overview, 43, 48
quick reference, 58
SDI (Single Document Interface), 404
sealed classes, 220
sealed methods, 220
security
anonymous access, 602-603
ASP.NET, 541
authentication, 602-603
Forms-based, 536-541, 556
managing, 536
semantics, 28
semi-colon, terminating, 28
separator bars, menu, 354
serialization, 483, 589
Server controls
adding to Web Forms, 523
creating event handlers, 523
overview, 514
Server Explorer, 441-442, 456, 468
server vs. client applications, 503
server vs. client validations, 525-527
Server.Transfer method, 577
set accessors, 252, 269
SetError method, 368
shared fields, 129
Sharing, 505
shift operators, 266
short circuiting, 61
shortcut keys, 345, 355
Simple API for XML (SAX), 483
simple data binding, 460-464, 477
Simple Object Access Protocol (SOAP), 483, 581-582, 589, 597-598
Single Document Interface (SDI), 404
SOAP (Simple Object Access Protocol), 483, 581-582, 589, 597-598
Sort property, 563
SortCommand event, 562
SortedList class, 184
sorting DataGrid controls, 560-563
SourceControl property, 355
Splitter control
adding, 375
docking, 375
overview, 373
resizing at run time, 395
SQL Server 2000, 438
SQL Server 2000 Desktop Engine, 438
SqlConnection object, 457, 473
SqlDataAdapter class, 473
SqlDataAdapter object, 456, 477
SqlDataReader class, 453
SqlDataReader object, 457
square brackets [ ], 39
Stack class, 183
stack memory, 143-144
State property, 473
statements
break, 80
checked, 100
continue, 80
decision. See decision statements
do, 77, 84-90
for, 76-77, 79
if. See if statements
iteration. See iteration statements
overview, 27
return, 45-47
switch. See switch statements
throw, 105-107
try/catch, 97-99
unchecked, 101
using, 238, 242-244, 246, 494
while, 75, 79-84
static fields, 130, 134
static keyword, 129
static members, 131-133
static methods, 128-133, 288-290
static properties, 255
static variables, 130
struct keyword, 157
struct types
compared to classes, 158-160, 309
creating, 165-168
creating values, 164
declaring, 158, 169
default constructors, 158
IntBits, 267
quick reference, 169
using, 165-168
struct variables
assigning values, 169
constructors, 162-163
copying, 163-164
declaring, 160, 169
definite assignment rules, 161
initializing, 169
structification, 256
styles compared to templates, 563
subclassing, 426
subscribing events, 291
switch statements
break statements, 70
no fall-through rule, 70
overview, 67
quick reference, 72
rules, 69
syntax, 68
writing, 70-72
symmetric operators, 304-306, 313-314
synchronizing ListView and TreeView controls, 388-394
synchronously invoking Web methods, 607
syntax
described, 28
destructors, 233
do statements, 78
for statements, 76
if statements, 63
indexers, 268
inheritance, 208-214
interfaces, 215
methods, 44, 47
multiple interfaces, 226
overview, 28
pointers, 149
switch statements, 68
terminating semicolon, 28
user-defined conversion operators, 312
using statements, 238
while statements, 75
system modal dialog boxes, 407
System namespace, 144-145
System.Array class, 178
System.Collections namespace, 179
System.Data.DataSet class, 470
System.Delegate class, 284
System.Drawing namespace, 427
System.IO namespace, 494
System.Object class, 144-145, 208
System.Web namespace, 516
System.Windows.Forms namespace, 415, 427
System.Xml namespace, 483, 494
System.Xml.Schema namespace, 494
T
tags, 480, 505
targetSchema property, 498
templates
ASP.NET Web Application, 523
ASP.NET Web Service, 584
Class, 590
Class Library, 427
Column, 563-568, 576
compared to styles, 563
Windows Control Library, 417, 433
XML File, 498
XML Schema, 498
terminating semicolon, 28
testing
applications, 334
ErrorProvider controls, 368
menus, 347
timesheet recording applications, 493
ToggleButton user controls, 432
Web applications, 602
Web Forms, 514, 518-521
Web methods, 587-588
XML schemas, 488-490
XML Web services, 596
Text property, 38, 461
TextBox control, 461
TextChanged event, 526
ThreeState property, 328
throw statements, 105-107
throwing exceptions, 104-109
tilde. See ~ bitwise operator
ToggleButton user control, 427-433
toolbars, MDI, 403
Toolbox
adding controls, 433
adding Login user controls, 423-424
adding ToggleButton user controls, 431-433
moving controls, 434
ToString method, 38
TreeNode objects, 382
TreeView control
AfterSelect event, 396
displaying hierarchical data, 395
handling events, 381-386
ImageList controls, 380
ListView controls, 388-394
using, 381-386
troubleshooting
errors. See errors
exceptions. See exceptions
try blocks
overview, 94
writing try/catch statements, 97-99
try/catch statements, 97-99
types
collection. See collections
conversions, 197
DataSets, 470
delegates. See delegates
enumeration. See enumeration types
int, 265
keyword equivalences, 164-165
reference, 135-139, 150, 285
struct types. See struct types
value, 135-139, 150
U
unary operators, 60, 266, 302
unassigned local variables, 31-32
unboxing, 146-148, 151
unchaining delegates, 292
unchecked integer arithmetic. See integer arithmetic
unchecked keywords, 101
unchecked statements, 101
unreachable objects, 235
unsafe code, 149
unsubscribing events, 292, 363
Update method, 476
updating
databases, 475-476, 478, 554-556
DataGrid control rows, 553-556
disconnected DataSets, 472-476
events, 476
user controls
ambient properties, 426
Browsable (false) attribute, 433
creating, 433
Login user controls, 416-426
overview, 415
properties, 419-421
specializing using subclassing, 426-433
user interfaces, 19-22
user-defined conversion operators, 312-313
using statements, 238, 242-244, 246, 494
V
valHandler method, 494
Validating event, 525
validation
CausesValidation property, 358, 369
client, 525-527, 533
controls, 525-533
disabling client, 530
disconnected DataSet updates, 472-474, 478
dynamic HTML, 532
error messages, 532, 533
ErrorProvider control, 366-369
events, 358, 369
implementing client, 527-532
Login user controls, 421-423
overview, 357
quick reference, 369, 533
server, 525-526, 533
unsubscribing events, 363
Windows Forms, 525
XML data, 494-496
XML files, 498
validation controls
CompareValidator, 527
CustomValidator, 527
list of types, 526
overview, 525
RangeValidator, 527, 529-530, 533
RegularExpressionValidator, 527
RequiredFieldValidator, 526-529, 533
ValidationSummary, 527, 530-533
ValidationEventHandler, 495, 498
ValidationSummary control, 527, 530-533
value parameters, 137-139
value types, 135-139, 150
values
compared to objects, 120, 231
creating, 164
variables
array. See arrays
bool, 59
collection types. See collections
declaring, 30
decrementing, 40, 74
implicit declarations not allowed, 30
incrementing, 40, 74
instance, 130
int, 135-139
naming, 29
overview, 27, 29
pi, 149
pointers, 148
primitive data types. See primitive data types
quick reference, 42
reference type, 135-139
static, 130
struct. See struct variables
ToolTips, 31
unassigned local, 31-32
value type, 135-139
virtual keyword, 212
virtual methods, 211, 229
Visual Studio .NET debugger. See debugger
W
Web applications
adding Web references, 607
building ASP.NET, 505-514, 559
caching, 548
creating ASP.NET, 505, 523, 563-570
creating client, 599, 604-605
quick reference, 577
sorting DataGrid controls, 560-563
testing, 602
Web.config, 505
Web Forms
accessing data, 535
adding HTML controls, 523
adding Server controls, 523
building login forms, 537-540, 556
buttons, 569-576
configuring applications to use Forms-based security, 540-541
control alignment and spacing, 509
creating, 572-574
creating applications, 537
creating styles, 523
DataGrid control. See DataGrid control
deleting rows of data, 550-553
displaying data, 542-546
editing data, 550-557
editing definitions, 523
hyperlinks, 569-576
layouts, 506-513
navigating between forms, 568-577
optimizing data access, 548-550
overview, 505
populating DataGrid controls, 545-546, 557
querying data, 541-550
quick reference, 556
retrieving data on demand, 546-548, 557
security, 536
Server controls, 514-515
testing, 514, 518-521
updating rows of data, 553-556
validation controls, 525-533
viewing definitions, 523
viewing HTML source code at run time, 523
Web methods
creating, 593-595
defining, 586-587
executing, 600, 604-607
invoking, 605, 607
monitoring execution of, 607
testing, 587-588
Web Service Description, 584
Web services. See XML Web services
Web Services Description Language (WSDL), 582-584
Web Sharing, 505
Web.config, 505
while statements, 75, 79-84
widening, 197, 312
Window menus, MDI, 412
Windows Control Library template, 417, 433
Windows Explorer, 371-373
Windows Forms. See also forms
Add button Click event, 336-337
adding controls, 328
changing properties programmatically, 326-327
CheckBox control, 333
Clear button Click event, 335-336
Click event for Add button, 336-337
Click event for Clear button, 335-336
Closing event, 337-338
ComboBox control, 332
compiling applications, 323-324
control properties, 329-335
controls, using, 327
creating applications, 320-324, 339
creating MiddleShire Bell Ringers Association project, 320
data binding, 460-468
database connections, 456
DataGrid control. See DataGrid control
DateTimePicker control, 328, 333
delegates for events, 338
displaying data, 442-446
GroupBox control, 333
list of properties, 324-326
ListBox control, 333
overview, 319
preprocessor directives, 327
processing events, 335
publishing events, 335
quick reference, 339
RadioButton control, 333
#region, 327
Reset method, 332, 334
setting properties, 321-322
validating user input, 525
wizards
C# Method Wizard, 51-54
Data Adapter Configuration Wizard, 465, 477, 543
Data Link Wizard, 456
World Wide Web Publishing Service, 505
WriteLine method, 193, 200
write-only indexers, 270, 278
write-only properties, 254, 263
WriteStartDocument method, 498
writing. See also programming
catch handlers, 96-99, 108-109
checked expressions, 101-104
checked statements, 100
ColorSyntaxVisitor class, 223
constructors, 122-126
conversion operators, 314-315
destructors, 233, 245
do statements, 77, 84-87
event handlers, 515-518
exception-safe code, 242-244
finally blocks, 109
for statements, 76-77
if statements, 65-67
indexers, 274
instance methods, 126-128
methods, 51-54
OK button code, 24
operator+ overloads, 310-311
params array methods, 200-203
programs, first, 7-11
return statements, 45-47
static members, 131-133
switch statements, 70-72
throw statements, 105-107
try/catch statements, 97-99
unchecked statements, 101
using statements, 242-244
while statements, 75, 80-84
XML files, 498
WSDL (Web Services Description Language), 582-584
X
XML
adding comments to code, 14
Analyze class, 494
APIs, 483
building timesheet recording applications, 490-493
creating documentation, 14-18
creating files, 498
creating schemas, 484-490, 498
creating timesheet analysis applications, 494-497
defining schemas, 484-488
DOM (Document Object Model), 483
DTDs (document type definitions), 483
event handlers, 494
goals, 480
indentation, 481
line breaks, 481
.NET Framework, 483
overview, 479
protocols, 483
quick reference, 498
saving data, 491-493
SAX (Simple API for XML), 483
schemas, 481, 498
serialization, 483
SOAP (Simple Object Access Protocol), 483
structure, 480
System.IO namespace, 494
System.Xml namespace, 494
System.Xml.Schema namespace, 494
tags, 480
tags, list of, 18
targetSchema property, 498
testing schemas, 488-490
testing timesheet recording applications, 493
transport formats, 483
validating data, 494-496
validating files, 498
ValidationEventHandler, 495, 498
Web services. See XML Web services
WriteStartDocument, 498
writing files, 498
XML File template, 498
XML Schema template, 498
XML Web services
adding references, 599-600
anonymous access, 602-603
authentication, 602-603
building, 579, 584
consuming, 597, 599-603
creating, 584-588, 596
creating client applications, 599, 604-605
creating Web methods, 593-595
Debug menu, 588
defining classes, 590-593
defining Web methods, 586-587
executing Web methods, 600, 604-607
handling complex data, 589-596
IIOP (Internet Inter-ORB Protocol), 580
invoking Web methods, 605, 607
monitoring execution of Web methods, 607
namespaces, 585
overview, 579
proxies, 597, 607
quick reference, 596, 607
, 610
RMI (Remote Method Invocation), 580
SOAP (Simple Object Access Protocol), 581-582, 589, 597-598
testing, 596
testing Web applications, 602
testing Web methods, 587-588
Web Service Description, 584
WSDL (Web Services Description Language), 582-584
XmlDocument class, 483
XmlSchemaCollection, 495
XmlTextReader object, 494, 498
XmlTextWriter object, 498
XmlValidatingReader, 495, 498
XOR (^) bitwise operator, 267
Last Updated: March 11, 2003
|