Exforsys.com
 
Home Tutorials VB.NET 2005
 

Setting and Adding Properties to Windows Form

 

Setting and Adding Properties to Windows Form - Page 2

Page 2 of 2




We have added two labels to the form class. These classes are merely declared in the class. The Contols_Load Sub contains the codes to edit the properties and to add them. The visible property of the form is set to true so these controls will be visible on the form. Now let us look at the value for the labels lblFirstNm and lblSeconNm which are initially assigned a value "Enter your First Name" and "Enter your Last Name".


Now take a look at the sub addNames. This sub takes two arguments, viz firstNm and SecondNm. The sub assigns the value of firstNm to lblFirstNm and the value of SeconNm to lblSecondNm. We also make some cosmetic change by making the font bold.


The action comes from the sub btnOk_click. Here we declare two string variables firstNm and secondNm. The value of the text from the two text box are captured and assigned to these variables in the respective order. Then the sub addNames is called here with the two names as arguments and the result can be seen in the two graphics that are given below:



See the screenshot below after the “Enter” button is clicked: You will also see that the value in the text boxe have been reset to null values.



Using Visual Inheritance


Inheritance allows you to derive one class from another class. Visual Basic provides a facility by which, while deriving a class from another class, you can also inherit the visual aspects of the class.

To derive a form from a Form1 which will inherit all aspects of Form1, including the controls on the form. Let us create a new project VisualInheritance and add a form Form1 to it. Now add a button botton1 to the form. Now click on the Build menu and click on Build VisualInheritance. This will enable the form to be available for being inherited.



Now right click on the project and you choose Add Inherited Form. You will see a window named inheritance picker. Choose the form Form1 in the window. The new inherited form will have the controls that were placed on the base form Form1.




First Page: Setting and Adding Properties to Windows Form


Read Next: Event Handling In Visual Basic .NET



 

 

Comments


fikmesf said:

  ::) How do I see the source code? every time I tried it gives me no authorization message. What should I do? please advise me

Mesfin
July 18, 2006, 5:57 am

vin said:

  its good site
April 3, 2007, 7:52 pm

sheetalraysoni said:

  ::) How do I see the source code? every time I tried it gives me no authorization message. What should I do? please advise me
October 3, 2007, 2:58 am

Ahmed_757 said:

  It is very difficult to see the code, would you please solve this problem
April 22, 2008, 3:01 am

Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2009 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape