Sign in to follow this  

Simple VB.NET Question

Recommended Posts

In VB.NET 2002/2003, Form1.Text sets the value of the Form1 variable's Text property to "My App." Form1.ActiveForm.Text sets the value of the application's active form to "My App." ActiveForm is a shared member of the Form class and doesn't really belong to Form1.

In VB 2005, the second example will be invalid. The second will give you a compile error because shared members/properties will no longer be able to be called off of an instance.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
RomSteady gave about as good an answer an any... but that will leave you wondering about 1 thing:

What is the use of ActiveForm (shared) member for??

suppose u r designing an MDI (Multiple Document Interface) application and u have multiple child forms... lets say 5 in all.

now u want to set the text of the "active child" form to "My App". instead of iterating through the child forms and finding the active one... u simply write:

MDIMain.ActiveForm.Text="My App"

and your job is done :-)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this