Home » C# Basics » 08 - Windows Programming - 1
8

What is windows programming?

Understanding what windows programming is

So far, we have created console applications. The main characteristic of a console application is that the code that we write is executed sequentially. The user has to follow the flow of the program as coded by the developer. For example, if the developer has written the code to enter the user's name first, then the age and then the gender, the user will follow the same sequence when entering the data.

Windows programming is very different from what we have seen so far. In windows applications, the user gets a screen full of controls such as textboxes, buttons and menus. To perform some action, user interacts with these controls by entering data, clicking, dragging or selecting. Since all the controls are available to the user, the developer cannot predict which control will be used by the user and in what sequence. In other words, we cannot control the flow of the program like in console applications. This is why we should be careful when writing the code. To understand this, let us consider a simple example. Suppose, our application includes a textbox to enter name and a button. The user enters her name in the textbox and then clicks the button. Our application displays a welcome message, including her name.

Since the user can see both the textbox and the button, she may choose to click the button before entering anything in the textbox. We should write the code to check for such situations.

Windows applications provide a rich user interface that makes the applications very easy to work with. Visual C# IDE and the .NET 2.0 Framework makes the task of developing windows applications very simple, as we will see in this chapter.