|
Home
Visual C# .NET Programming Tutorials
Learn Visual C# .NET Table of
Contents
Learn
Visual C# .NET - Table of Contents
1. Introduction to the Visual C# .NET Environment
Preview 1-1
Course Objectives 1-2
What is Visual C# .NET? 1-3
Visual C# .NET 2003 versus Visual C# .NET 1-5
A Brief Look at Object-Oriented Programming (OOP) 1-6
Structure of a Visual C# .NET Windows Application 1-7
Steps in Developing a Windows Application 1-9
Starting Visual C# .NET 1-10
Visual C# .NET Integrated Development Environment (IDE) 1-12
Drawing the User Interface 1-20
Example 1-1: Stopwatch Application - Drawing Controls 1-23
Opening a Saved Visual C# .NET Project 1-24
Setting Properties of Controls at Design Time 1-26
Setting Properties at Run Time 1-29
How Names Are Used in Control Events 1-30
Use of Form Name Property 1-31
Example 1-2: Stopwatch Application - Setting Properties 1-33
Writing Code 1-35
Working with Event Methods 1-37
Variables 1-40
Visual C# .NET Data Types 1-41
Variable Declaration 1-43
Arrays 1-45
Constants 1-46
Variable Initialization 1-47
Intellisense Feature 1-48
Example 1-3: Stopwatch Application - Writing Code 1-49
Running An Application 1-52
Class Review 1-55
Practice Problems 1 1-56
Problem 1-1. Caption Problem
Problem 1-2. Enabled Problem
Problem 1-3. Date Problem
Exercise 1: Calendar/Time Display 1-57
2. The Visual C# .NET Language
Review and
Preview 2-1
A Brief History of Visual C# .NET 2-2
Rules of C# Programming 2-3
Visual C# .NET Statements and Expressions 2-4
Type Casting 2-6
Visual C# .NET Arithmetic Operators 2-8
Comparison and Logical Operators 2-10
Concatenation Operators 2-12
Strings to Numbers to Strings 2-13
Visual C# .NET String Methods 2-15
Dates and Times 2-19
Random Number Object 2-22
Math Functions 2-23
Example 2-1: Savings Account 2-25
Tab Stops and Tab Order 2-31
Example 2-2: Savings Accounts – Setting Tabs 2-33
Improving a Visual C# .NET Application 2-34
Visual C# .NET Decisions - if Statements 2-35
Switch - Another Way to Branch 2-39
Key Trapping 2-42
Control Focus 2-45
Example 2-3: Savings Account - Key Trapping 2-46
Visual C# .NET Looping 2-51
Visual C# .NET Counting 2-55
Example 2-4: Savings Account - Decisions 2-57
Class Review 2-64
Practice Problems 2 2-65
Problem 2-1. Random Number Problem
Problem 2-2. Price Problem
Problem 2-3. Odd Integers Problem
Problem 2-4. Pennies Problem
Problem 2-5. Code Problem
Exercise 2-1: Computing a Mean and Standard Deviation 2-66
Exercise 2-2: Flash Card Addition Problems 2-67
3. Exploring the Visual C# .NET Toolbox
Review and Preview 3-1
Function Overloading 3-2
MessageBox Dialog 3-3
Form Object 3-8
Button Control 3-11
Label Control 3-13
TextBox Control 3-15
Example 3-1: Password Validation 3-18
CheckBox Control 3-23
RadioButton Control 3-25
GroupBox Control 3-27
Panel Control 3-29
Handling Multiple Events in a Single Method 3-31
Control Arrays 3-34
Example 3-2: Pizza Order 3-36
ListBox Control 3-43
ComboBox Control 3-46
Example 3-3: Flight Planner 3-48
Class Review 3-52
Practice Problems 3 3-54
Problem 3-1. Message Box Problem
Problem 3-2. Tray Problem
Problem 3-3. List Box Problem
Problem 3-4. Combo Box Problem
Exercise 3: Customer Database Input Screen 3-55
4. More Exploration of the Visual C# .NET Toolbox
Review and
Preview 4-1
Control Z Order 4-2
NumericUpDown Control 4-3
DomainUpDown Control 4-5
Example 4-1: Date Input Device 4-8
Horizontal and Vertical ScrollBar Controls 4-11
TrackBar Control 4-14
Example 4-2: Temperature Conversion 4-16
Picture Box Control 4-21
Example 4-3. “Find the Burger” Game 4-24
OpenFileDialog Control 4-29
Example 4-4: Picture Box Playground 4-32
Legacy Controls 4-37
DriveListBox Control 4-39
DirListBox Control 4-40
FileListBox Control 4-41
Synchronizing the Drive, Directory, and File List Box Controls 4-43
Example 4-5: Image Viewer 4-45
Class Review 4-52
Practice Problems 4 4-53
Problem 4-1. Tic-Tac-Toe Problem
Problem 4-2. Number Guess Problem
Problem 4-3. File Times Problem
Exercise 4: Student Database Input Screen 4-54
5. Windows Application Design and Distribution
Review and Preview 5-1
Application Design Considerations 5-2
TabControl Control 5-3
Example 5-1: Shopping Cart 5-6
Using General Methods in Applications 5-21
Example 5-2: Average Value 5-24
Returning Multiple Values from General Methods 5-31
Example 5-3: Circle Geometry 5-33
MainMenu Control 5-38
ContextMenu Control 5-44
Font Object 5-45
FontDialog Control 5-47
Example 5-4: Note Editor 5-49
Distribution of a Visual C# .NET Application 5-57
Debug Versus Release Configurations 5-60
Application Icons 5-61
Visual C# .NET Setup Wizard 5-64
Installing/Removing a Visual C# .NET Application 5-76
Class Review 5-78
Practice Problems 5 5-79
Problem 5-1. Tab Control Problem
Problem 5-2. Note Editor About Box Problem
Problem 5-3. Normal Numbers Problem
Problem 5-4. Context Menu Problem
Exercise 5: US/World Capitals Quiz 5-80
6. Sequential Files, Error-Handling
and Debugging
Review and Preview 6-1
Sequential Files 6-2
Sequential File Output (Variables) 6-4
Application Path 6-7
Example 6-1: Writing Variables to Sequential Files 6-8
Sequential File Input (Variables) 6-12
Example 6-2: Reading Variables from Sequential Files 6-14
Parsing Data Lines 6-18
Example 6-3. Parsing Data Lines 6-20
Reading Tokenized Lines 6-24
Example 6-4. Reading Tokenized Lines 6-25
Building Data Lines 6-27
Example 6-5: Building Data Lines 6-30
Configuration Files 6-36
Example 6-6: Configuration Files 6-38
Writing and Reading Text Using Sequential Files 6-42
SaveFileDialog Control 6-45
Example 6-7: Note Editor - Reading and Saving Text Files 6-48
Error Handling 6-51
Run-Time Error Trapping and Handling 6-52
Example 6-8: Note Editor - Error Trapping 6-56
Debugging Visual C# .NET Programs 6-58
Example 6-9: Debugging Example 6-60
Using the Debugging Tools 6-63
Debugging Strategies 6-76
Class Review 6-77
Practice Problems 6 6-78
Problem 6-1. Option Saving Problem
Problem 6-2. Text File Problem
Problem 6-3. Data File Problem
Problem 6-4. Debugging Problem
Exercise 6-1: Information Tracking 6-80
Exercise 6-2: ‘Recent Files’ Menu Option 6-81
7. Graphics Techniques with Visual
C# .NET
Review and Preview 7-1
Simple Animation 7-2
Example 7-1: Simple Animation 7-4
Timer Control 7-7
Example 7-2: Timer Control 7-9
Basic Animation 7-11
Example 7-3: Basic Animation 7-13
Random Numbers (Revisited) and Games 7-18
Example 7-4: One-Buttoned Bandit 7-20
Randomly Sorting Integers 7-28
Example 7-5: Random Integers 7-30
Graphics Methods 7-34
Graphics Object 7-35
Colors 7-37
ColorDialog Control 7-39
Pen Object 7-41
DrawLine Method 7-42
Graphics Methods (Revisted) 7-43
Persistent Graphics 7-46
Example 7-6: Drawing Lines 7-50
Rectangle Structure 7-55
DrawRectangle Method 7-57
Brush Object 7-58
FillRectangle Method 7-59
Example 7-7: Drawing Rectangles 7-60
DrawEllipse Method 7-65
FillEllipse Method 7-66
Example 7-8: Drawing Ellipses 7-67
DrawPie Method 7-70
FillPie Method 7-72
Example 7-9: Drawing Pie Segments 7-74
Pie Charts 7-80
Line Charts and Bar Charts 7-83
Coordinate Conversions 7-86
Example 7-10: Line, Bar and Pie Charts 7-93
Class Review 7-102
Practice Problems 7 7-103
Problem 7-1. Bounce Problem
Problem 7-2. Dice Rolling Problem
Problem 7-3. RGB Colors Problem
Problem 7-4. Plotting Problem
Problem 7-5. Pie Chart Problem
Exercise 7-1: Blackjack 7-104
Exercise 7-2: Information Tracking Plotting 7-105
8. More Graphics Methods and
Multimedia Effects
Review and Preview 8-1
Mouse Events 8-2
Example 8-1: Blackboard 8-5
Persistent Graphics, Revisited (Image and Bitmap Objects) 8-14
Example 8-2: Blackboard (Revisited) 8-17
More Graphics Methods 8-20
Point Structure 8-21
DrawLines Method 8-22
DrawPolygon Method 8-24
FillPolygon Method 8-25
Example 8-3: Drawing Lines and Polygons 8-27
DrawCurve Method 8-34
DrawClosedCurve Method 8-35
FillClosedCurve Method 8-36
Example 8-4: Drawing Curves 8-38
Example 8-5: Drawing Animated Curves 8-43
HatchBrush Object 8-46
Example 8-6: Hatch Brush 8-48
LinearGradientBrush Object 8-50
Example 8-7: Linear Gradient Brush 8-52
TextureBrush Object 8-54
Example 8-8: Texture Brush 8-55
DrawString Method 8-57
Multimedia Effects 8-63
Animation with DrawImage Method 8-64
Example 8-9: Bouncing Ball 8-66
Scrolling Backgrounds 8-72
Example 8-10: Horizontally Scrolling Background 8-75
Sprite Animation 8-80
Keyboard Events 8-83
Example 8-11. Sprite Animation 8-86
Collision Detection 8-91
Example 8-12: Collision Detection 8-92
Windows API Functions 8-97
Simple Beeps 8-99
Example 8-13: Playing Beeps 8-101
More Elaborate Sounds 8-104
Example 8-14: Bouncing Ball with Sound! 8-106
Class Review 8-108
Practice Problems 8 8-109
Problem 8-1. Blackboard Problem
Problem 8-2. Rubber Band Problem
Problem 8-3. Shape Guessing Game
Problem 8-4. Plot Labels Problem
Problem 8-5. Bouncing Balls Problem
Problem 8-6. Moon Problem
Problem 8-7. Sound File Problem
Exercise 8: The Original Video Game - Pong! 8-110
9. Other Visual C# .NET Topics
Review and Preview 9-1
Other Controls 9-2
LinkLabel Control 9-4
Example 9-1: Link Label Control 9-5
MonthCalendar Control 9-7
DateTimePicker Control 9-9
Example 9-2: Date Selections 9-10
RichTextbox Control 9-12
Example 9-3: Rich Text Box Example 9-15
ImageList Control 9-18
ToolBar Control 9-21
Example 9-4: Note Editor Toolbar 9-24
ToolTip Control 9-30
Adding Controls at Run-Time 9-31
Example 9-5: Rolodex – Adding Controls at Run-Time 9-34
Printing with Visual C# .NET 9-36
Printing Pages of a Document 9-39
PageSetupDialog Control 9-45
PrintDialog Control 9-48
PrintPreviewDialog Control 9-50
Example 9-6: Printing 9-52
Adding a Help System to Your Application 9-61
Creating a Help File 9-63
Starting HTML Help Workshop 9-64
Creating Topic Files 9-66
Creating Table of Contents File 9-69
Compiling the Help File 9-73
HelpProvider Control 9-76
Example 9-7: Help System Display 9-78
Class Review 9-80
Practice Problems 9 9-81
Problem 9-1. Biorhythm Problem
Problem 9-2. Rich Textbox Note Editor Problem
Problem 9-3. Loan Printing Problem
Problem 9-4. Plot Printing Problem
Problem 9-5. Note Editor Help Problem
Exercise 9: Phone Directory 9-83
10. Visual C# .NET Database and Web
Applications
Review and Preview 10-1
Database Applications 10-2
Database Structure and Terminology 10-3
Database Access Tools 10-7
Database Connection 10-8
DataSet Objects 10-12
Simple Data Binding 10-21
Database Navigation 10-23
Example 10-1: Accessing the Books Database 10-24
Creating a Virtual Table 10-29
Example 10-2: Creating a Virtual Table 10-30
DataView Objects 10-38
Example 10-3: ‘Rolodex’ Searching of the Books Database 10-40
Complex Data Binding 10-44
Web Applications 10-46
Web Form Application Requirements 10-48
Starting a New Web Application 10-50
Web Form Controls 10-53
Building a Web Application 10-59
Example 10-4: Loan Payments 10-61
Example 10-5: Loan Repayment Schedule 10-67
Class Review 10-72
Course Summary 10-73
Practice Problems 10 10-74
Problem 10-1. New DataView Problem
Problem 10-2. Multiple Authors Problem
Problem 10-3. Stopwatch Problem
Exercise 10: The Ultimate Application 10-75
11. Object-Oriented Programming
(OOP)
Preview 11-1
Objects in Visual C# .NET 11-3
Adding a Class to a Visual C# .NET Project 11-4
Declaring and Constructing an Object 11-5
Adding Properties to a Class 11-6
Another Way to Add Properties to a Class 11-8
Validating Class Properties 11-9
Adding Constructors to a Class 11-11
Adding Methods to a Class 11-13
Inheritance 11-18
Example 11-1. Savings Account 11-24
Inheriting from Visual C# .NET Controls 11-31
Building a Custom Control 11-32
Adding New Properties to a Control 11-36
Adding Control Event Methods 11-40
Example 11-2. Savings Account (Revisited) 11-42
Class Review 11-47
Appendix I. General Purpose Methods
Average AI-2
BarChart AI-3
BlankLine AI-5
CircleGeometry AI-6
DegFTodegC AI-7
LineChart AI-8
LoanPayment AI-10
MidLine AI-11
PieChart AI-12
RandomNormalNumber AI-14
RectangleInfo AI-15
SortIntegers AI-16
SoundEx AI-17
StandardDeviation AI-18
xUserToxClient AI-19
yUserToyClient AI-19
Practice Problems Solutions (Part
1: Classes 1 to 5) P1-1
Practice Problems Solutions (Part 2: Classes 6 to 10) P2-1
Exercise Solutions (Part 1: Classes 1 to 5) E1-1
Exercise Solutions (Part 2: Classes 6 to 10) E2-1
Back to Top
Back to Learn Visual C# .NET
|