Programming in Visual C# 2008 / Julia Case Bradley, Anita C. Millspaugh.
By: Bradley, Julia Case [author.]
Contributor(s): Millspaugh, A. C. (Anita C.)
Publisher: Boston : McGraw-Hill Higher Education, c2010Description: xxiv, 679 pages : illustrations ; 28 cmContent type: text Media type: unmediated Carrier type: volumeISBN: 9780070172814Subject(s): Microsoft Visual C# | C# (Computer program language) | Visual programming languages (Computer science)DDC classification: 006.6/63 LOC classification: QA76.73.C154 | B7324 2010Online resources: Table of contents onlyItem type | Current location | Home library | Call number | Status | Date due | Barcode | Item holds |
---|---|---|---|---|---|---|---|
BOOK | COLLEGE LIBRARY | COLLEGE LIBRARY SUBJECT REFERENCE | 005.133 B728 2010 (Browse shelf) | Available | CITU-CL-39716 |
Includes index.
Chapter 1
Introduction to _Programming and _Visual C# 2005 1
Writing Windows Applications with Visual C# 2
The Windows Graphical User Interface 2
Programming Languages?Procedural, _Event Driven, and Object Oriented 3
The Object Model 3
Microsoft?s Visual Studio .NET 5
Writing C# Programs 6
The Three-Step Process 6
C# Application Files 7
The Visual Studio Environment 7
Default Environment Settings 8
The IDE Initial Screen 8
The New Project Dialog 9
The IDE Main Window 9
The Toolbars 11
The Document Window 12
The Form Designer 12
The Solution Explorer Window 12
The Properties Window 12
The Toolbox 12
Help 12
Design Time, Run Time, and Debug Time 14
Writing Your First C# Project 14
Set Up Your Workspace 14
Plan the Project 17
Define the User Interface 18
Set Properties 20
Write Code 27
C# Code Statements 28
Code the Event-Handling Methods _for Hello World 31
Run the Project 33
Save Your Work 34
Open the Project 35
Modify the Project 36
Print the Code 41
A Sample Printout 42
Automatically Generated Code 43
Finding and Fixing Errors 44
Syntax Errors 44
Run-Time Errors 45
Logic Errors 46
Project Debugging 47
Modifying an Event Handler 48
Naming Rules and Conventions for Objects 50
Visual Studio Help 51
Installing and Running MSDN 52
Viewing Help Topics 52
Context-Sensitive Help 54
Managing Windows 54
Your Hands-On Programming Example 55
Chapter 2
User Interface Design 65
Introducing More Controls 66
Text Boxes 66
Masked Text Boxes 67
Rich Text Boxes 68
Displaying Text on Multiple Lines 69
Group Boxes 69
Check Boxes 70
Radio Buttons 70
A Simple Radio Button Example 70
Picture Boxes 72
Setting a Border and Style 74
Using Images for Forms and Controls 75
Drawing a Line 75
Working with Multiple Controls 75
Selecting Multiple Controls 75
Deselecting a Group of Controls 76
Moving Controls as a Group 77
Setting Properties for Multiple Controls 77
Aligning Controls 77
Designing Your Applications for_User Convenience 78
Designing the User Interface 78
Defining Keyboard Access Keys 79
Setting the Accept and Cancel Buttons 80
Setting the Tab Order for Controls 80
Setting the Form?s Location on the Screen 82
Creating ToolTips 82
Coding for the Controls 84
Clearing Text Boxes and Labels 85
Resetting the Focus 85
Setting the Checked Property of Radio_Buttons and Check Boxes 85
Setting Visibility at Run Time 86
Disabling Controls 86
Setting Properties Based on User Action 86
Changing the Color of Text 87
Concatenating Text 87
Your Hands-On Programming Example 88
Chapter 3
Variables, Constants, and Calculations 101
Data?Variables and Constants 102
Data Types 103
Naming Rules 104
Naming Conventions 104
Constants: Named and Intrinsic 105
Declaring Variables 108
Scope and Lifetime of Variables 110
Calculations 113
Converting Strings to a Numeric Data Type 113
Arithmetic Operations 115
Order of Operations 116
Using Calculations in Code 117
Converting between Numeric Data Types 119
Performing Calculations with Unlike_Data Types 120
Rounding Numbers 121
Formatting Data for Display 122
Using Format Specifier Codes 122
Choosing the Controls for Program Output 124
A Calculation Programming Example 125
Planning the Project 125
The Project Coding Solution 128
Handling Exceptions 129
try/catch Blocks 130
Displaying Messages in Message Boxes 132
The TextMessage String 133
The Titlebar Text 133
MessageBoxButtons 134
MessageBoxIcon 134
Using Overloaded Methods 134
Testing Multiple Fields 135
Counting and Accumulating Sums 137
Summing Numbers 137
Counting 138
Calculating an Average 138
Your Hands-On Programming Example 138
Chapter 4
Decisions and Conditions 153
if Statements 154
Charting if Statements 156
Conditions 156
Comparing Numeric Variables and Constants 157
Comparing Character Data 158
Comparing Strings 159
Testing for True or False 161
Comparing Uppercase and_Lowercase Characters 161
Compound Conditions 162
Short-Circuit Operations 163
Nested if Statements 164
Coding an else if 166
Using if Statements with Radio Buttons_and Check Boxes 168
A ?Simple Sample? 169
Checking the State of a Radio Button Group 170
Checking the State of Multiple Check Boxes 171
Enhancing Message Boxes 171
Displaying the Message String 172
Displaying Multiple Buttons 173
Input Validation 175
Checking for a Range of Values 175
Checking for a Required Field 175
Performing Multiple Validations 176
Limiting User Actions by Disabling Controls 177
The switch Statement 178
Sharing an Event Handler 181
Calling Event Handlers 184
Your Hands-On Programming Example 185
Debugging C# Projects 192
Writing to the Output Window 193
Pausing Execution with the Break All Button 194
Forcing a Break 194
Checking the Current Values of Expressions 195
Stepping through Code 195
The Locals Window 197
The Autos Window 197
Debugging Step-by-Step Tutorial 198
Chapter 5
Menus, Common Dialog_Boxes, and Methods 213
Menus 214
Defining Menus 214
Creating a Menu?Step-by-Step 220
Coding for Menu Items 220
Standards for Windows Menus 223
Common Dialog Boxes 223
Displaying a Windows Common Dialog Box 224
Using the Information from the Dialog Box 225
Using the Color Dialog Box 225
Using the Font Dialog Box 226
Setting Initial Values 227
Creating Context Menus 227
Creating a Context Menu?Step-by-Step 228
Sharing Methods 230
Writing General Methods 231
Creating a New Method 231
Passing Arguments to Methods 232
Writing Methods That Return Values 233
Methods with Multiple Arguments 235
Reference and Output Parameters 236
Breaking Calculations into Smaller Units 238
Basing a New Project on an _Existing Project 240
Your Hands-On Programming Example 241
Chapter 6
Multiform Projects 257
Using Multiple Forms 258
Creating New Forms 258
Adding and Removing Forms 260
An About Box 261
Using the About Box Template 261
Setting Assembly Information 262
Displaying an About Form 264
Using the Methods and Events of Forms 264
Showing a Form 264
Hiding or Closing a Form 265
Responding to Form Events 266
The Sequence of Form Events 266
Writing Event Handlers for Selected Events 267
Variables and Constants in _Multiform Projects 267
Creating Properties in a Class 268
Applying the Properties to Multiple Forms 270
A Splash Screen 271
Creating a Splash Screen 271
Controlling the Time a Splash _ Screen Displays 272
Making the Splash Form Display First 272
Running Your Program Outside the IDE 273
Your Hands-On Programming Example 274
Chapter 7
Lists, Loops, and Printing 291
List Boxes and Combo Boxes 292
The Items Collection 293
Filling a List 293
The SelectedIndex Property 296
The Items.Count Property 296
Referencing the Items Collection 297
Removing an Item from a List 297
Clearing a List 298
List Box and Combo Box Events 299
The while and do/while Loops 300
The bool Data Type Revisited 302
Using a while Loop with a List Box 302
for Loops 303
Negative Increment or Counting Backward 305
Conditions Satisfied before Entry 305
Endless Loops 306
Exiting for Loops 306
Skipping to the Next Iteration of a Loop 306
Making Entries Appear Selected 307
Selecting the Entry in a Text Box 307
Sending Information to the Printer 308
The PrintDocument Component 308
Printing the Contents of a List Box 312
Printing the Selected Item from a List 313
Aligning Decimal Columns 313
Displaying a Print Preview 314
Printing Multiple Pages 315
Your Hands-On Programming Example 316
Chapter 8
Arrays 329
Single-Dimension Arrays 330
Subscripts 330
Valid Subscripts 332
foreach Loops 332
Structures 333
Declaring Variables Based on _a Structure 334
Accessing the Elements in a _Structure Variable 334
Including an Array in a Structure 335
Using Array Elements for Accumulators 336
Adding to the Correct Total 336
Debugging Array Programs 337
Table Lookup 338
Coding a Table Lookup 339
Using List Boxes with Arrays 341
Multidimensional Arrays 342
Initializing Two-Dimensional Arrays 343
Printing a Two-Dimensional Table 344
Summing a Two-Dimensional Table 344
Lookup Operation for Two-Dimensional Tables 345
Your Hands-On Programming Example 348
Chapter 9
Programming with_Web Forms 367
C# and Web Programming 368
Client/Server Web Applications 368
Types of Web Sites 370
File System Web Sites 370
IIS Web Sites 370
Remote Sites and FTP Sites 371
Creating a Web Site 371
Web Page Files 372
Web Forms in the Visual Studio IDE 372
Creating Your First Web Form?Step-by-Step 372
Viewing the HTML Code 375
Controls 375
Event Handling 376
Files 376
Debugging 377
Testing in Other Browsers 378
Laying Out Web Forms 378
Using Tables for Layout 378
Including Images on Web Pages 380
Navigating Web Pages 382
Using Hyperlinks 382
Adding a Second Web Page 382
Transferring Pages in Code 384
Using the Validator Controls 385
Maintaining State 386
Retaining the Contents of Controls 386
Retaining the Values of Variables 386
Passing Values to a Second Page 387
Managing Web Projects 388
Using the Copy Web Site Tool 389
Some Web Acronyms 389
Your Hands-On Programming Example 390
Chapter 10
Accessing Database Files 401
Database Files 402
C# and Database Files 402
Database Terminology 402
XML Data 403
Using ADO.NET and C# 404
Data Access in Visual Studio 2005 405
Binding Sources 406
Table Adapters 406
Datasets 407
Creating a Database Application 407
A Windows Database Application?Step-by-Step 407
The Grid?s Smart Tag 410
The Database Schema File 411
Binding Individual Data Fields 412
Selecting Details View 413
Database Details Program?Step-by-Step 414
Selecting Records from a List 415
Converting to Combo Box Selection?Step-by-Step 416
Selecting Fields from the Table 418
Sorting the List Data 419
Choosing the Control Type for Fields 420
Selecting Records Using Web Forms 422
Security in Web Database Applications 422
Creating the Web Selection Application?_Step-by-Step 423
Moving Database Projects 427
Your Hands-On Programming Example 428
Chapter 11
Saving Data in Files 435
Data Files 436
File Handling Using Streams 436
Writing Data in a File 437
Reading Data from a File 440
Using the File Common Dialog Box 443
OpenFileDialog Component Properties 443
Displaying the Open File Dialog Box 444
The Open and Write File Program 446
Saving the Contents of a List Box 448
Loading the List Box 448
Checking for Existence of the File 449
Saving the File 449
Querying the User to Save 450
The Form_FormClosing Event Handler 450
Reading an XML File 451
Nodes, Elements, and Attributes 451
The XmlTextReader Class 453
Your Hands-On Programming Example 455
Chapter 12
OOP: Creating Object-_Oriented Programs 465
Object-Oriented Programming 466
Objects 466
Object-Oriented Terminology 467
Reusable Classes 469
Multitier Applications 469
Classes 470
Designing Your Own Class 470
Creating Properties in a Class 471
Class Methods 471
Constructors and Destructors 471
Creating a New Class?Step-by-Step 472
Property Methods with Mixed Access Levels 477
Creating a New Object Using a Class 478
Defining and Using a New Object?Step-by-Step 478
Instance Variables versus Static Variables 480
Adding Static Properties to the Step-by-Step _Exercise 482
Destructors 484
Garbage Collection 484
Inheritance 484
Inheriting Properties and Methods 485
Overriding Methods 485
Accessing Properties 486
Creating a Derived Class Based on ClothingSale 486
Adding Inheritance to the Step-by-Step Exercise 487
Creating a Base Class Strictly for Inheritance 490
Inheriting Form Classes 491
Setting the Startup Form 495
Managing Multiclass Projects 495
Adding an Existing Class File to a Project 495
Using the Object Browser 495
Examining C# Classes 496
Examining Your Own Classes 496
Your Hands-On Programming Example 498
Chapter 13
Graphics, Animation, Sound, and Drag-and-Drop 519
Graphics in Windows and the Web 520
The Graphics Environment 520
Steps for Drawing Graphics 520
The Paint Event Handler 521
Pen and Brush Objects 521
The Coordinate System 523
Graphics Methods 524
Random Numbers 526
Simple Animation 528
Displaying an Animated Graphic 528
Controlling Pictures at Run Time 529
Moving a Picture 531
The Timer Component 531
The Scroll Bar Controls 531
Scroll Bar Properties 534
Scroll Bar Events 535
A Programming Example 535
Playing Sounds 536
Adding Sound Files to the Resources for a Project 537
A Sound-Playing Program 537
Drag-and-Drop Programming 539
The Source Object 539
The Target Object 540
The Drag-and-Drop Program 541
Your Hands-On Programming Example 543
Chapter 14
Additional Topics in C# 551
Advanced Validation Techniques 552
Using ErrorProvider Components 552
The MaxLength and CharacterCasing Properties 554
Field-Level Validation 555
Using the Validating Event and CausesValidation Property 555
Capturing Keystrokes from the User 559
Using the Masked Text Box for Validation 559
Code Snippets and Samples 560
Code Snippets 560
Sample Projects 560
Multiple Document Interface 560
Creating an MDI Project 561
Adding a Window Menu 562
Toolbars and Status Bars 564
Toolbars 564
Status Bars 565
Some Helpful Date Controls 566
The Calendar Controls 566
Displaying Web Pages on a Windows Form 569
The WebBrowser Control 569
A WebBrowser Program 570
Checking for the Enter Key 572
Appendix A
Answers to Feedback_Questions 577
Appendix B
Methods for Working with Dates, Mathematics, _and String
Operations 591
Working with Dates 592
The DateTime Structure 592
Retrieving the System Date and Time 593
Date Variables 593
Converting Values to a Date Format 594
Mathematical Methods 594
Working with Strings 595
Methods for Conversion between Data Types 598
Appendix C
Tips and Shortcuts for Mastering the Environment 599
Set Up the Screen for Your Convenience 600
Close or Hide Extra Windows 600
Use the Full Screen 603
Modify the Screen Layout 603
Split the Screen Vertically 604
Reset the IDE Layout 604
Set Options for Your Work 604
Use Shortcuts in the Form Designer 605
Use the Layout Toolbar 605
Nudge Controls into Place 605
Use Snap Lines to Help Align Controls 605
Copy Controls Quickly 606
Use Shortcuts in the Editor 606
Comment and Uncomment Selected Lines 607
Use the Text Editor Toolbar 607
Use Keyboard Shortcuts When Editing Code 608
Split the Editor Window 608
Use Drag-and-Drop Editing 609
Use the Task List 609
Drag Commonly Used Code to the Toolbox 609
Rename Variables and Objects 610
Reformat the File 610
Use Context-Sensitive Help 610
Use the Debugging Tools 610
The Debug Toolbar and Menu 610
Set Breakpoints 611
View the Contents of Expressions 611
Single-Step through the Code 612
Write to the Output Window 612
Copy and Move Projects 613
Copy and Move a Windows Project 613
Copy and Move a Web Project 613
Rename and Remove Event Handlers 613
Rename an Event Handler 614
Remove an Event Handler 614
How C# Sets Up Event Handlers 614
Deploy Applications 615
Appendix D
.NET Security 617
Authentication and Authorization 618
IIS Authentication 618
Authorization and Impersonation 620
Writing Secure Code 621
SQL Injection 621
Error Messages 621
Code Access Security 621
Glossary 623
Index 6331
000-099 005
There are no comments for this item.