Last Modified 5-1-2010




Introduction to C#

.NET Framework

VS2008 IDE

How C# is Compiled

Start Visual Studio

Windows Form App

C# OOP Coding

C# Code Example

C# Coding Rules


Error Window

C# Comments

C# Help Window

Language Essentials

C# Data Types

Declare Variables

Declare Constants

Arith. Expressions

Assign Statements

Operator Precedence

Type Casting

Math Class

C# Strings

String Esc Sequences

Convert Data Types

ToString Formatting

Variable Scope Use

C# Enumeration Use

C# Nullable Types

Program #2

C# Code Control

Relational Operators

Logical Operators

If-Else Statement

Switch Statement

How to Design a Windows Forms Application

From the Microsoft Visual Studio Start Page, select File → New Project as indicated in the diagram below:

File → New Project

Figure CS-7: Visual Studio File → New Project

If C# is not your preferred language in Visual Studio, you must indicate that you wish to develop a project in C# rather than Visual Basic or Visual C++. C# is found under Other Languages in the Project Dialog Window as indicated in the diagram below:

Other Languages

Figure CS-8: Microsoft Visual Studio Other Languages

Double-clicking on other Languages will bring up Microsoft Visual C#/C++ in Visual Studio. Select the Visual C# template menu by double-clicking on the Microsoft Visual C# option as indicated in the diagram below:

Visual C#

Figure CS-9: Microsoft Visual C# Template Selector

The Visual C# New Project Template Selector is indicated in the diagram below:

Form App

Figure CS-10: Microsoft Visual C# New Project Form Application

Perform the following steps to bring up a C# Windows Form Application Startup Template:

  1. Select Visual C#: Make sure C# is the development language selected.
  2. Select Windows: Select a Visual type application.
  3. Select Windows Form Applications: The program will run as a PC application.
  4. Name Project: Invoice Total will be the name we choose for our first project.
  5. OK: Select OK when all the proper options have been selected.

Make sure your Control Toolbox is enabled by selecting:

View → Toolbox

as indicated in the diagram below:

View Toolbox

Figure CS-10A: Enable Visual Studio Toolbox

Some terms that we will be referencing at a later point in the guide are illustrated in Figure CS-11 are:

  • File Selection Menu: Menu options performing system actions such as Save Project
  • Debug Program: Icon to test our C# program.
  • Design Tabs: Selectors to move between Source code and Forms
  • Design Form: User Interface.
  • Control Toolbox: Templates for control to be placed on the form.

After performing the preceding steps - the C# Design View window will appear on your screen as indicated in the diagram below:

Design View

Figure CS-11: Visual C# Design View Screen

Select Toolbox → Common Controls as indicated in the diagram below:

Toolbox Common Controls

Figure CS-12: Visual C# Toolbox Common Controls

  1. Left-Click the Toolbox: to make it visible.
  2. Left-Click the '+' on Common Controls: to expand the Common Control Toolbox Menu.

Select the Next button below to continue this tutorial: