My first Windows form application

Windows form application

Windows form application remains a vital part of windows software development ecosystem even today. There are plenty of alternatives like WPF or sliverlight, but if you are starting to learn coding windows software, Windows form application is good enough to start off with.

You will require Visual studio to develop application, so download it, if you aren’t currently having one and install

DOWNLOAD LINK

I’m using Visual studio 2008. So create a new application in visual studio by clicking :

File>>New>>Project

Windows form application 1

and select Windows from project types and select windows form applications from Project templates and name the project and click Ok. This is make project with a form1.cs file in it.

Form1 design will be displayed to you. Go to the properties of the form1 and select the window state as maximized. This will make the form run in Maximized state when running our application.

Windows form application 2

 

Adding controls on the Form : 

To add controls on the form, press Ctrl+W,X or from View option in the menu stripe select Toolbox, this will display the toolbox. From here you can drag and drop controls on to your form. Select Button control and drag on to your form.

Windows form application 3

Select the button and click F4 key, this will open the properties of the button, over here Change the text to Simple ButtonWindows form application 4 Now hit the F5 key and run the application, this will display the form1.

Handling the Button Click Events:

In visual studio, press Shift+F5, this will close the application if it is in running mode.

Now double click on our button, this will open the code page of our Form1.cs. Over here, write this code :

windowsform5

 

This code will show a simple message box to our user, displaying message Hi there!!. Now press F5 and run your application. This is a very basic example of windows form applications, I will be posting more codes related to this, so do visit again, if you are just starting off with developmental work. Happing coding!!!



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.