howt use global variable like functionality in vb.net?

B

Bob Powell [MVP]

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.
 
S

Stoitcho Goutsev \(100\) [C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top