Should be a simple question

In a Microsoft Windows Application, how do you access the controls of a Form from a Module?  In VB6 the syntax to change the textbox on form "MyForm" from a module was something like: Form_FormName.mytextbox.Value = 2333.

Does anyone know the syntax for vb.net?
dchau12Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
pauljk1619Commented:
frmName.mytextBox.Text = 2333
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
It depends on the version of VB.Net you have...

For VB.Net 2003 and below, you can't use the Forms name like you used to in VB6.  You must have a reference to the form you want to iterate over.  This means either passing into your sub/function in your module or by declaring a global public form variable in your module and then setting that global variable from your forms load event.

In VB.Net 2005, you can use the Forms name just like you did in VB6.  VB.Net 2005 also has a forms collection similar to VB6:
http://msdn2.microsoft.com/en-us/library/system.windows.forms.application.openforms(VS.80).aspx
There is no OpenForms() collection in VB.Net 2003 and below (there is for MdiChildren but thats different).  If you want one there you have to track the open forms yourself in a your own collection such as the ArrayList.
0
 
dchau12Author Commented:
Thanks for the input guys
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.