Creating a Simple C Sharp GUI Application with Visual Studio

From Techotopia
Revision as of 19:12, 10 January 2008 by Neil (Talk | contribs) (New page: In the previous chapter we looked at the creation of a very simple console based C# program. In this chapter we will take this concept a step further by creating a small GUI (Graphical Use...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In the previous chapter we looked at the creation of a very simple console based C# program. In this chapter we will take this concept a step further by creating a small GUI (Graphical User Interface) based application using Visual Studio.

Installing Visual Studio with C# Support

Access to a system running Visual Studio with C# support is a pre-requisite for this tutorial. If you do not have a copy of Visual Studio you have the option of either downloading and installing the free Visual Studio Express product or a free 90-day trial of Visual Studio Professional. During the installation process it is important to ensure that C# support is selected.

Once Visual Studio is installed and running launch it from the Windows Start menu.

Creating a new Visual Studio C# Project

Once Visual Studio is running the first step is to create a new project. Do this by selecting New Project from the File menu. This will cause the New Project window to appear containing a range of different types of project. For the purposes of this tutorial we will be developing a Windows Forms Application so make sure that this option is selected. At the bottom of the window is a field for providing a project name. This will most likely display a default file name along the lines of WindowsFormsApplication1. Change this to HelloCSharp and press the OK button to initiate the creation of the new project.

Once the new project has been created the main Visual Studio window will appear. At the center of this window will be a new form in which will create the user interface for our sample C# application.


Adding Components to the Windows Form