Creating a new Project in C#
For this tutorial, you are going to need Microsoft Visual studio or C# express version installed on your computer.
If you don’t have one, Microsoft offers two free versions at the moment that you can download from Microsoft website:
Visual Studio Express version
Visual Studio Express editions provide free tools to develop applications for a specific platform, such as Windows Universal Platform applications, web sites, and Windows desktop applications.
Currently, you can download Express editions for:
- Express for Desktop: Supports the creation of desktop applications for Windows.
- Express for Web: Create standards-based, responsive websites, web APIs, or real-time online experiences using ASP.NET.
- Express for Windows: Provides the core tools for building compelling, innovative apps for Universal Windows Platform. Windows 10 is required.
- Team Foundation Server 2015 Express: Free source-code-control, project-management, and team-collaboration platform.
Download: Visual Studio Express versions
Visual Studio Community Version
Visual Studio Community has all the features of Express and more, and is still free for individual developers,
open source projects, academic research, education, and small professional teams.
Download: Visual Studio Community
There are other Visual Studio Versions, Visual Studio Professional and Visual Studio Enterprise for professionals and enterprises
After installing your Visual studio product, Depending on your operating system, start Microsoft C#, a Start window will open.
Click on “New Project…” or open File Menu than “New Project…” to create a new project.
A Sub window will pop out giving you options of different templates of Visual C# 2010 which includes
Windows Form Application, WPF Application, Console Application, Class Library and WPF Browser Application.
To design a GUI, select Window Forms Application, give it a name and click OK.
After you click OK, a new Windows Application project will be created for you with a blank form.
1. The Form
This is the main Graphical Window of the program appearing in the middle. It is here where we will put all the controls (Buttons, labels, combo boxes ect.).
2. The ToolBox
The ToolBox contains all the controls that we need to create our program. All you need to
do is to drag and drop a control from the ToolBox on the left hand side onto the Form.
3. Properties and Solution Explorer (4)
Each control like a button has its properties.
A property of a control is things like its Height, its Width, its Name, its Text, and a whole lot more.
To see what properties are available for a specific control, make sure that its selected first by just clicking on it on the form and then check its properties on the bottom right hand side.
For example by clicking the Form, you can change its Text properties from “Form1” to let say “Gui Test”.
The Text property of a control is what is displayed on that control, (Like a Send button, “Send” will be its text property) but the Name property of a control its the name of that control used in the code (Send button will have a name like bntSend).
When naming a control, start with a letter and don’t include space or special characters.
In the solution Explorer, you will see the name of the current project and all the forms as normally a project can have more than one forms.
To save your project, go to file menu and click save or click on save icon on the toolbar to save your project. When you click on save for the first time, you will be prompted to choose a directory where to save your project and give it a name.