To use a public variable that is inside a class (a form is a class) you have to specify the instance that you are using.

For example:

Dim frmForm1 as New Form1
Dim frmForm2 as New Form2

You can then say Msgbox frmForm1.Variable

Unlike VB6 which creates you a form automatically the first time you call it, you have to explicitly create them.


Use this code for your loop



visual basic code:--------------------------------------------------------------------------------

Dim ctrl As Control

For Each ctrl In Me.Controls
ctrl.Enabled = False
Next

--------------------------------------------------------------------------------
your correct but in large application using the collection is easier and much cleaner