Adding Controls on Form in Windows Forms Application



Adding Controls on Windows Form

In our previous c#.net tutorial we did successfully run windows application. Now, in this post we will learn how to add server control on windows form.

There are two types of controls.
A Server side controls and Client side control.

The server side control must have runat=’server’ attribute tag. All c#.net controls are server side controls where as all HTML controls are client side control. Server Side Controls can be directly accessible from code behind programming page. The Client Side controls are not directly accessible on code behind page. We can access them with other methods.


Adding controls on Form

If we want to add some control on web page, we can use Toolbox on the left side in Visual Studio. All the server side controls are placed in Toolbox panel.

Open Toolbox and just select control drag and drop control to web form where you want. If Toolbox not visible in visual studio, got to View menu select Toolbox option to visible Toolbox in Visual Studio OR press “Ctrl + w + x” key to add Toolbox in visual studio.

Toolbox only visible at design view of form not on code view.

View menu – > Toolbox  or  Ctrl + w + x

Here, we can see all server side controls in toolbox in below figure.

meeraacademy.com
Add controls on windows form application from toolbox.

Now, lets add some controls on windows form. for add TextBox control on windows form from Toolbox, just select TextBox control in Toolbox and drag and drop on windows form or make double click on TextBox control. In below screen we have three server controls added on windows form a textbox, a button and a label control.

meeraacademy.com
Add controls on windows form application.

The TextBox control allow user to input values, the Button control execute programming code when user click on it and the label control display text message on windows form.

We hope that this windows application tutorial helped you to understand about server side control and how to add control on windows form in visual studio.


Next, c# windows application tutorial we will learn about Properties of server control.


 

Leave a Reply

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