Click to See Complete Forum and Search --> : Access to Form from Main


Ehsan
March 27th, 2001, 04:43 AM
Hi

I have written a VB program that starts from Sub Main. Sub Main is in a Module and Also I have a form in my project.

How can I access to my form and it's controls from Sub Main

Thanks

Clearcode
March 27th, 2001, 04:46 AM
You can reference a form directly by name i.e. if your form is called "Form1" and has a textbox "txtName" rthen the following is perfectly valid in code:

Debug.print Form1.txtName.Text




Note that your VB form is also a template for the creation of forms of the same type i.e.:

Dim frmThis as Form1

set frmThis = new Form1
Debug.print frmThis.txtName.Text




HTH,
Duncan

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com