howt use global variable like functionality in vb.net?

  • Thread starter Thread starter Guest
  • Start date Start date
You should not use global variables in a correctly constructed object
oriented architecture.

Perhaps you could have the main parent implement an interface that enables
you to get the info you need and have the child forms cast their parent to
this interface.

Perhaps you can just expose a property of the main form and have child
windows cast the Parent object to your main form type.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Renjith,

If you use .NET 2.0 take a look at My.Application.OpenForms collection. The
main application form should be at index 0.

For .NET 1.x you should do some work by yourself in order
to have the reference to the Main form accesible from anywhere in the code.
For example you can implement singleton design pattern.
 
Back
Top