Training
Certifications
Books
Special Offers
Community




 
Microsoft® Visual C#™ .NET (Core Reference)
Author Mickey Williams
Pages 784
Disk 1 Companion CD(s)
Level All Levels
Published 05/15/2002
ISBN 9780735612907
ISBN-10 0-7356-1290-0
Price(USD) $59.99
To see this book's discounted price, select a reseller below.
 

More Information

About the Book
Table of Contents
Sample Chapter
Index
Companion Content
Related Series
Related Books
About the Author

Support: Book & CD

Rate this book
Barnes Noble Amazon Quantum Books

 

Table of Contents


    Acknowledgmentsxxi
    Introductionxxiii
PART I   INTRODUCING MICROSOFT VISUAL C# .NET 
1   A Tour of Visual Studio .NET and Visual C# .NET 3
    Creating Applications for the .NET Platform 4
        The .NET Framework 4
        Understanding Assemblies 5
    Overview of Visual Studio .NET 9
        The Start Page 9
        Visual Studio .NET Windows 12
        Visual Studio .NET Options 18
        Visual Studio .NET Help 21
    Creating Visual C# Solutions 22
        Using Project Templates 22
        Generating a New Solution 24
    Layout of a Typical Visual C# Program 25
        Commenting Your Source 26
        Using Namespaces 27
        Declaring a Class 28
        Defining a Main Method 28
        Compiling Your Project 29
        Providing Output for Hello World 30
    Conclusion31
2   C# Basics33
    Basic Data Types 34
        The .NET Common Type System 35
        The Common Language Specification 36
    Classes 37
        Adding a Class in Visual C# 37
        Declaring a Class 38
        An Introduction to Inheritance 39
        The object Base Class 44
        Members 45
        Inheritance and Methods 55
        Accessibility 58
    Namespaces 61
        Creating a New Namespace 62
        Using a Namespace 63
        Adding References 64
    Interfaces 66
        Using Interfaces 66
        Classes and Interfaces 67
    Managing Errors with Exceptions 67
        Handling Exceptions 68
        .NET Framework Exceptions 73
    Casting 74
    Structures 76
        Structures and Inheritance 76
        Allocating Structures 77
        Member Functions 77
    Enumerations 78
    Conclusion79
3   Value Types and Reference Types81
    Understanding Value Types 82
        Value Type Lifetime 83
        Boxing 84
        Declaring New Value Types 85
    Understanding Reference Types 85
        Working with Arrays 86
        Working with Strings 91
        Reference Type Lifetime and Garbage Collection 93
    Conclusion100
4   Operators, Type Conversions, and Properties101
    Examining Operators 102
        Comparing Objects with the Relational Operators 103
        Forming Logical Expressions with the Logical Operators 104
        Doing Math with the Arithmetic Operators 105
        Managing Bit Patterns with the Bitwise Operators 107
        Setting Variables with the Assignment Operators 110
        Using the Conditional Operator 112
        Obtaining Type Information 113
        Addressing Memory Directly 113
        Using Other Operators 114
    Working with Operators 115
        Understanding Operator Precedence 115
        Using the checked and unchecked Keywords 116
        Defining Operators for Your Types 117
        Creating a New Value Type 119
        Controlling the Behavior of && and || 123
    Converting Types 125
        Performing Implicit Conversions 125
        Performing Explicit Conversions 126
        Using the Convert Class 127
        Performing User-Defined Conversions 127
    Basic String Formatting for Numeric Values 128
    Using Properties as Smart Fields 130
    Conclusion 131
5    Flow of Control 133
    Selecting Code Paths Conditionally 134
        The if Statement 134
        The switch Statement 137
    Building Loops Using Iteration Statements 140
        The for Loop 140
        The foreach Loop 143
        The while Loop 145
        The do Loop 147
    Using Jump Statements to Transfer Control 149
        The break Statement 150
        The continue Statement 151
        The goto Statement 152
        The return Statement 153
        The throw Statement 153
        Transferring Control out of an Exception Handling Block 154
    Conclusion155
PART II   ADVANCED C# 
6   Delegates and Attributes 159
    Using Delegates 160
        Creating Delegates 161
        Using Delegates as Callback Methods 162
        Using Delegates as Functors 165
        Combining Delegates 166
        Iterating Manually over the Delegate Chain 168
        Using Delegates with Non-Static Methods 170
    Handling Events 173
        Using Event Fields 175
        Raising Events 175
        An Example Using Events 176
    Working with Attributes 179
        Using Attributes 179
        Resolving Attributes 180
        Defining Custom Attributes 181
        Creating a Strong Name 190
    Conclusion192
7   Indexers and Enumerators 193
    Using Indexers 194
        Declaring an Indexer 195
        Declaring Indexers for Interfaces 197
        An Indexer Example 198
    Using Enumerators 201
        Understanding Enumeration Interfaces 202
        Implementing Enumeration Interfaces 203
        Consuming Enumeration Interfaces 207
    Conclusion208
8   Collections and Sorting 211
    Comparing and Sorting 211
        Creating Comparable Types with the IComparable Interface 212
        Building Comparison Classes with the IComparer Interface 214
    Storing Objects in Collection Classes 219
        Commonly Used Collection Interfaces 219
        Using the Queue Class 224
        Using the Stack Class 229
        Using the Hashtable Class 231
        Using the Specialized Collection Classes 234
    Conclusion 236
9   Debugging Techniques 237
    Compiling Code Conditionally 237
    Tracing the Stack 241
        Displaying the Call Stack 241
        Accessing Detailed Method Information 243
    Using the Trace and Debug Classes 244
        Generating Program Trace Information 245
        Displaying Messages with the Trace and Debug Classes 245
        Controlling Output with Switches 249
        Consuming Trace Messages with Trace Listeners 252
    Debugging with Visual Studio .NET261
        Setting Breakpoints 261
        Using the Call Stack 264
    Conclusion 265
10   Advanced Topics 267
    Writing Multithreaded Code 267
        Understanding Application Domains 268
        Working with Threads 268
        Synchronizing Access to Shared Objects 273
        Working Asynchronously Using the Thread Pool 284
    Using Unsafe Code 289
        Examining the Need for Unsafe Code 289
        Declaring Unsafe Contexts 290
    Conclusion296
PART III   PROGRAMMING WINDOWS FORMS 
11   An Introduction to Windows Forms 299
    Understanding Windows Forms 300
        Using Forms as Dialog Boxes 300
        Using Forms as Views 301
    Developing a Simple Windows Forms Project 301
        Examining Files Created by Visual C# .NET 302
        Executing a Windows Forms Project 306
        Adding a New Form to a Project 307
        Modal Forms vs. Modeless Forms 308
        Determining the DialogResult Value 308
        Passing Values to Forms 309
    Displaying Information with Message Boxes 311
        Specifying Message Box Buttons 311
        Adding Icons to Message Boxes 312
        Defining Default Buttons for Message Boxes 313
        Controlling Special Cases for Message Boxes 313
        Specifying a Parent Window for a Message Box 314
    Controlling a Windows Forms Application 315
        Starting an Application 315
        Determining Application Path Information 317
        Performing Idle Work 318
        Closing an Application 318
    Using Form Properties to Affect Form Behavior 320
        Setting Border Styles 320
        Defining Other Form Properties 321
    Conclusion 323
12   Adding Controls to Forms 325
    An Introduction to Controls 326
    Using the Button Classes 327
        The ButtonBase Class 327
        The Button Class 327
        The RadioButton Class 334
        The CheckBox Class 335
    Basic Event Handling 336
        Event Handling Architecture 336
        Adding New Event Handlers 337
        Removing Event Handlers 340
        Translating Key Presses into Button Clicks 340
        Validating the Contents of Controls 341
    Using the TextBox Class 343
        Hiding Passwords in a Text Box Control 344
        Working with Multiline Text Box Controls 344
        Using Other Text Box Properties 346
    Using the Label Class 347
    Using the LinkLabel Class 347
        Handling the Click Event 348
        Unique LinkLabel Properties 348
    Using the ListBox Class 350
        Adding Items to a List Box 351
        Removing Items from a List Box 353
        Preventing Repainting When Updating a List Box 354
        Selecting List Box Items 354
        Using Other List Box Properties 359
    Using the CheckedListBox Class 360
        Checking Items in a Checked List Box 361
        Handling Events from the Checked List Box 362
    Using the ComboBox Class 363
        Using Combo Box Properties 363
        Handling Combo Box Events 365
    Scrolling Controls with the ScrollBar Classes 366
    Controls That Act as Containers 367
        Embedding Controls 368
        The GroupBox Class 369
        The Panel Class 369
    Conclusion 370
13   User Input and Feedback 371
    Working with the Mouse 372
        Handling Mouse Movement Events 372
        Handling Mouse Selection Events 374
        Providing Feedback with the Mouse Pointer 378
    Accepting Keyboard Input 385
        Obtaining the Input Focus 386
        Using the Keys Enumeration 387
        Handling Events from the Keyboard 389
    Using a Main Menu with Forms 391
        Creating a Main Menu 392
        Handling Menu Events 399
        Updating Menu Items 400
        Using Multiple Menus 401
        Creating a Simple Editor 402
    Implementing Shortcut Menus 410
        Creating Basic Shortcut Menus 411
        Programming with Shortcut Menus 411
    Providing Feedback with Status Bars 414
        Creating Status Bars 414
        Using Status Bar Panels 415
        Displaying the Time and Date 420
    Conclusion422
14   GDI+ 423
    Understanding Windows Forms Geometry 424
        Specifying Locations with the Point Structure 424
        Defining the Size of Visual Elements 425
        Defining Rectangles 426
    Using the Graphics Class 427
        Handling the Paint Event 428
        Drawing Text with GDI+ 428
        Drawing Lines 432
        Drawing Rectangles 433
        Filling Rectangles 434
    Using Color with Windows Forms 437
        Creating Color Structures 437
        Using Color Properties 439
        Using the Current System Colors 440
        The Color Common Dialog Box 441
    Using Brushes 444
        Creating Solid Brushes 446
        Using the TextureBrush Class 447
        Filling Shapes with Patterns Using Hatch Brushes 450
        Using the LinearGradientBrush Class 452
        Using the PathGradientBrush Class 456
    Drawing with Pens 458
        Using the SystemPens and Pens Classes 458
        Using the Pen Class 460
    Using Fonts 465
        Understanding the Vocabulary of Fonts 465
        Using the FontCollection Classes 468
        Font Metrics 469
        The Font Common Dialog Box 473
    Conclusion474
15   Advanced Controls 475
    Using Up-Down Controls 476
        The NumericUpDown Control 476
        The DomainUpDown Control 478
    Using the ProgressBar Control 479
    Using the PictureBox Control 481
    Using the ImageList Control 481
    Using the RichTextBox Control 483
        Common Formatting Options 484
        Loading a RichTextBox Control from a File 486
        Saving the Contents of a RichTextBox Control 487
    Using TabControl Controls 487
        Creating TabPage Objects 488
        Managing TabPage Objects Programmatically 488
        Creating TabControl Controls with the Windows Forms Designer 489
        Managing TabControl Controls 491
    Using the MonthCalendar Control 494
    Using the DateTimePicker Control 500
    Managing the Position and Size of Controls 503
        Anchoring Controls 504
        Docking Controls 506
    Conclusion 508
16   Grid, Tree, and List Controls 509
    Using the DataGrid Control 510
        Displaying Database Data 510
        Displaying Hierarchical Data in Data Grids 514
        Advanced Data Grids 517
    Displaying Hierarchical Information in a TreeView Control 520
        Designing a TreeView Control 520
        Generating Dynamic TreeView Controls 523
        Implementing Your Own TreeView Control 528
    Using the ListView Control 531
        Implementing a ListView Control 531
        RegistryViewer—TreeView and ListView Combined 537
    Conclusion 539
17   Enhancing Windows Forms 541
    Adding Toolbars 542
        Creating a Toolbar 542
        Modifying the Toolbar's Appearance 544
        Defining Toolbar Button Styles 548
    Using the Clipboard 551
        Copying to the Clipboard 551
        Retrieving Data from the Clipboard 552
        Exploring Clipboard Formats 553
        Storing the Same Data in Multiple Formats on the Clipboard 555
    Working with Drag and Drop 556
        Drag and Drop Basics 556
        Enabling FileDrop 559
        Implementing a Drag and Drop Source 560
    Conclusion 563
PART IV   DATA ACCESS AND XML 
18   ADO.NET 567
    What's New in ADO.NET 567
        The ADO.NET Disconnected Model 568
        XML Integration 568
        ADO.NET Datasets 568
        .NET Data Providers 568
    Creating and Using Datasets 569
        Adding Records 570
        Detecting "Dirty" Data 571
        Accepting Changes 571
        Binding to Data Components 571
        Persisting Data 572
    Establishing a Connection to a Data Store 572
        Constructing Connection Objects 573
        Connecting to the Database 573
        Pooling Connections with .NET Data Providers 574
        Initiating Transactions 576
        Completing the Transaction 577
        Closing the Connection 578
    Executing a Command 579
        Constructing Command Objects 579
        Providing Command Text 580
        Associating with a Connection 580
        Associating with a Transaction 580
        Configuring the Command Time-Out 581
        Specifying Command Types 581
        Passing Parameters 581
        Executing Commands 583
    Using a DataReader Object to Retrieve Data 585
    Using a DataAdapter Object to Populate a Dataset586
        Constructing DataAdapter Objects 586
        Associating Commands with the DataAdapter 587
        Filling Datasets 588
        Updating Data 589
        Mapping Tables 590
        Using the Data Adapter Configuration Wizard 591
    Conclusion 595
19   XML 597
    Reading and Writing XML 598
        Using XmlTextWriter to Create XML 599
        Using XmlTextReader to Read XML 607
    Using the Document Object Model (DOM) 613
        Working with XML Documents 615
        Sample Application Using the DOM 619
    Using XML with Datasets 623
        Placing XML Data into a Dataset 623
        Writing XML from a Dataset 627
    Using Visual C# .NET to Edit XML Files 627
        Creating and Editing XML Raw Data 628
        Viewing and Editing the Schema 628
        Adding XML Data 630
    Conclusion 631
PART V   ASP.NET AND WEB SERVICES 
20   Web Forms635
    Requirements for Working with ASP.NET 636
    Features of ASP.NET 636
        Separation of Logic from the User Interface 637
        Compiled Pages 637
        Support for Multiple Languages 637
        Event-Driven Model 637
        Improved Object Model 638
        Scalability and Performance 638
        Security 638
        Support for Tracing and Debugging 638
    An Introduction to Web Forms 639
        Server-Based Programming 639
        Postbacks and Round-Trips 641
        Disconnected Access and Page Regeneration 642
    Creating a Basic Web Forms Page 643
        Creating the Project 643
        Creating the Calculator1 Web Forms Page 645
        Adding Controls 646
        Adding Static HTML Text 647
        Programming the Button Controls 648
        Running the Page 649
        Examining the Calculator1 Web Forms Page 649
    Web Forms Controls 653
        Standard User Interface Controls 654
        Controls for Displaying Data 654
        Validation Controls 655
        Special-Purpose Controls 656
        Web Server Control Events 656
    Creating a Web Forms Page with Control Events 658
        Creating the Configuration Web Forms Page 658
        Creating List Items for the ListBox Control 659
        Creating the Event Handlers 660
    Maintaining State: Persisting Values Between Round-Trips 663
    Creating a Web Forms Page That Persists Values 664
        Creating the Calculator2 Web Forms Page 666
        Adding Code to the Calculator2 Web Forms Page 666
    Working with Data in Web Forms 669
        Creating the DataBinding_Simple Web Forms Page 670
        Binding to an ADO.NET Dataset 671
        Working Directly Against the Database 672
        Storing Datasets 673
        Working with List Data Controls 675
    Conclusion 682
21   SOAP and Web Services 683
    Understanding SOAP 684
    Understanding Web Services 684
        The WebService Directive 684
        Deriving from the System.Web.Services.WebService Class 685
        Using the WebService Attribute 685
        Using the WebMethod Attribute 687
    Creating a Web Service 687
        Creating Web Service Classes 689
        Creating Web Methods 689
    Identifying Web Services Using Discovery 691
        Using Static Discovery 691
        Using Dynamic Discovery 691
        Advertising Your Discovery Pages 692
        Understanding WSDL 692
    Browsing a Web Service 693
    Consuming a Web Service 695
        Using the HTTP GET Protocol 695
        Using the HTTP POST Protocol 696
        Using the SOAP Protocol 697
        Referencing a Web Service in the Visual Studio .NET IDE 698
        Generating a Web Service Proxy 700
    Deploying Web Services 701
    Securing Web Services 701
        Configuring IIS Authentication 702
        Using Digital Certificates 703
        Setting Internet Protocol Security 704
        Providing Custom Authentication 704
    Conclusion 704
INDEX707



Last Updated: April 23, 2002
Top of Page