How to Call FORMS

Madz

Centurion
Joined
Jan 22, 2003
Messages
155
I am getting confused with one thing. Here in .NET forms are working as classes. for example a form frmabout is a complete class.

I want to call that form from some other form object, such as in VB6 if there are 2 forms we call call each other from any other object. I want to access a method on frmabout from other form but i am unablt to do so. Frmabout is already loaded in memory

in case of if i write
Code:
dim frmM as new frmAbout
frmM.Show
frmM.xxxx

it opens a new form, and calls the method

if i try to call directly such as like
Visual Basic:
frmAbout.Xxx

it do not show my form's methods its just shows methods as like a class

if i try

Visual Basic:
Dim frmM as frmAbout = frmAbout.ActiveForm

it raise an error

Is there any way to do so ?
 
Make sure the method is public.

.. and can you please get rid of that distracting signature. I think we get the idea of what your nick is without having to go blind.
 
What Wyrd said abut the method and just keep one instance of the form available to the whole class so if you need it you dont have to create the form every time.

BTW I dont see anything very distracting in his sig :) Only 3 lines of normal size font and two of them got different color :)
 
When you first create the form, keep a reference to the instance around. You can then use it whenever you like at a later point.
 
Is this good if i make a module and in module i enter this

Visual Basic:
public frmM as new frmAbout

and with in code i call it;s reference.
 
Last edited:
That's one way to do it; a tidier method might be to use the form class itself instead of a module and declare a static (shared) variable on it to hold the instance.
 
Back
Top