Jump to content
  • Advertisement
Sign in to follow this  
Kryptus

Simple VB.NET Question

This topic is 4828 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What's the difference between using Form1.Text = "My App" and Form1.ActiveForm.Text = "My App" ???

Share this post


Link to post
Share on other sites
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!