CSharp forms application 1

CSharp forms application 1

windows form

Image credit:infragistics.com

In our CSharp forms application 1, we now, going to be making Windows Applications, instead of Console based Applications. Windows Applications make utilization of something many refer to as a Form. The Form is clear at first. you then add control to your Form, things like textboxes, buttons, menus, check boxes, radio buttons, and so forth. To get your first take a gander at a Windows Form, do the accompanying.

To make your first Windows Form application, tap the File menu once more. This time, select New Project from the menu. When you do, you’ll see the New project dialogue box once more. This one in C#




In all forms, select Windows Forms based application (or Windows Application in prior variants) from the accessible layouts. Keep the Name on the default of WindowsFormsApplication1 and after that snap or click OK.

When you click OK, another Windows based project application will be made for you:


Now, we will go through all the pictorial representations to make you clear how you can build your first form based application in CSharp







When we click the Form1.designer.cs code, we will see the code to clear the memory from all the garbage and unused resources is written there



InitializeComponent is a method automatically written for you by the Form Designer when you create/change your forms.

Every Forms file (e.g. Form1.cs) has a designer file (e.g. Form1.designer.cs) that contains the InitializeComponent method, the override of the generic Form.Dispose, and the declaration of all of your User Interface objects like buttons, textboxes and labels.

The InitializeComponent method contains the code that initialize the user interface objects with the values provided by you (the programmer) using the Property Grid of the form designer. Also, you will find here, the plumbing required to link the controls and form events to the specific event handlers you write to respond to the user actions.

The code contained in Form1.cs and the Form1.Designer.cs files is part of the same class thanks to the concept of partial classes that could keep two or more parts of your code together like a single block of code.

Of course, due to the high chance of modifications required by any user interface, it is a really good advice to not try to modify manually this method, while, sometime I find useful to add code to the Dispose method.


Syed Adeel Ahmed
Syed Adeel Ahmed
Analyst, Programmer, Educationist and Blogger at Technofranchise
Computer Systems Engineer from Sir Syed University Of Engineering & Technology.I am passionate about all types of programming.

Published by

Syed Adeel Ahmed

Computer Systems Engineer from Sir Syed University Of Engineering & Technology.I am passionate about all types of programming.

Leave a Reply