alt
Advertisement
Online Training
Career Series
Exforsys
Exforsys arrow Tutorials arrow VB.NET 2005 arrow Setting and Adding Properties to Windows Form
Site Search


Setting and Adding Properties to Windows Form
Article Index
Setting and Adding Properties to Windows Form
Page 2

Setting and Adding Properties to a Windows Form

In this tutorial we wil leran about Setting and Adding Properties to a Windows Form, Using the Visual Designer to set Windows Form Properties, Setting Windows Forms Properties programatically and Using Visual Inheritance along with the sample project and screen shots.

Using the Visual Designer to set Windows Form Properties

The properties of the Widows properties can be edited in the properties window visually. Both the inherited properties and also those added in the current class can be edited using the property window. If this window is not visible, you can click on the menu view and choose property window. Alternatively you can click F4 to invoke this window.

This window can be docked to a side and can be hidden or pinned to the desk. If it is hidden then if the mouse hovers over the title bar of the property window it then becomes visible. We and see how the properties of a text box and a grid control can be edited in the illustration:

In the above screen shot, see the button titled OK and all the properties of the button are available so that it can changed.

We can also see another illustration involving grid box control: The screen shot below displays properties that can be changed.

Setting Windows Forms Properties programmatically

You may have a clear idea of value of the properties and the controls at design time and they can be edited using the method explained above. However most of the time the value of the property of several items cannot be identified at design time and they have to be set at run time based on several considerations. Visual Basic provides facility to edit and initialize or substitute the value of the properties programmatically. Le us see an illustration.

Start a new project and add a form to the project. This form will be the starting form by default. Add two text boxes and a command button to the form and place them as shown below:

Now you can proceed to add the codes for the program by double clicking the form. You will see the controls.vb file opened. Add the following codes to the form as given below:

Click here to view the Source Code



 
< Prev   Next >
Sponsored Links
© 2008 Exforsys.com
Joomla! is Free Software released under the GNU/GPL License.
Page copy protected against web site content infringement by Copyscape