C# Simplified, part 6: Working with Windows Applications
(Page 1 of 4 )
In this article, you will learn about Windows-based applications by creating and modifying one. You will also learn two ways to create controls for these applications, and why TextBoxes are particularly important.
If you have worked with Visual Basic 6.0 or Visual C++ 6.0, you may be aware of the various Graphical User Interface (GUI) elements with which you worked. These elements include buttons, text boxes, check boxes, radio buttons and many more. In fact there are dozens of other controls which are used, along with various Windows-based applications. Windows-based applications are called WinForms for short. With WinForms, you can develop standalone applications. This means that you can run those applications only under a Windows platform and with the .NET Framework. The end user should either install .NET Framework or .NET redistributable framework in order to work with Windows-based applications. If you want to develop ASP.NET applications, you should use WebForm controls.
The System.Windows.Forms namespace provides all necessary classes and methods for developing powerful GUI applications. It is this namespace which provides access to WinForm controls and their associated methods and properties. If you are using a plain text editor instead of Visual Studio .NET, you have to know about the various properties and their corresponding values. But if you have Visual Studio .NET, the properties for each of the controls can be modified from the properties window, and the appropriate coding will be automatically done in the background. The compilation and execution stages are same as any other C# application. The only difference is that the output can be viewed through a Form. The source code will become lengthy as you develop complex application with WinForms.
The code samples in this article assume that you are using a plain text editor such as Notepad for coding purposes. |
The .NET Framework supplies more than 60 controls for developing Windows applications. Even though all these controls are not used in a single project, they can be suitably used for various purposes. For example, if you are developing a data entry project, you can make use of TextBoxes and Validation Controls. If you are working on a billing project, you can use Buttons, DataGrid and CheckBoxes. The usage of these controls depends upon each project's requirements.
If you have Visual Studio .NET, you can view the names of all these controls from the ToolBox. Just place your mouse pointer over the ToolBox section on the left hand side and the Visual Studio .NET automatically displays all the controls. As you can see, these controls are divided into tabs. For instance, the controls used for developing database applications are located in a tab titled "Data." In the same way, reusable and user created controls are placed in a tab titled "Components."
The different types of controls used for building a WinForm application is given in Figure 6.1.
I will explain some of the important controls shown in the above figure in this article and in the upcoming articles. You can learn about rest of the controls which are not discussed in this series with the help of the MSDN library or the documentation which came with the .NET Framework SDK.
Visual Studio .NET supports a feature called Dynamic Help. In order to make use of this feature you have to install the MSDN library which came with Visual Studio .NET. To understand its functionality, add a control like Timer to the form and press F1. |
Next: My first WinForm application >>
More C# Articles
More By Anand Narayanaswamy