vb-> form1.show

  • Thread starter Thread starter Hareth
  • Start date Start date
H

Hareth

VS2003

if i say

dim form1 as new form1
form1.show()

It opens a new form everytime...

But....what if....
"form1" opened.....
then I told it to hide, using me.hide()....
how would i show it again?
Wouldnt "as new" open a new form1? instead of showing the one thats hidden?

If i write:

form1.show()

that generates errors (refrence to a non-shared member requires an object
refrence)...

So how would i show a hidden form
 
Hareth said:
VS2003

if i say

dim form1 as new form1
form1.show()

It opens a new form everytime...

Of course it does. You're initializing a 'new' object every time.
But....what if....
"form1" opened.....
then I told it to hide, using me.hide()....
how would i show it again?
Wouldnt "as new" open a new form1? instead of showing the one thats
hidden?

If i write:

form1.show()

that generates errors (refrence to a non-shared member requires an object
refrence)...

So how would i show a hidden form

in Form1, add the following

Public Shared myForm as Form1

Then, in the Form1_Load event:
myForm = Me

In other forms, you can access that instance of form1 by calling:
Form1.myForm.<whatever>

HTH,

-Jason
 
Xlnt!!!!.....


OpticTygre said:
Of course it does. You're initializing a 'new' object every time.

in Form1, add the following

Public Shared myForm as Form1

Then, in the Form1_Load event:
myForm = Me

In other forms, you can access that instance of form1 by calling:
Form1.myForm.<whatever>

HTH,

-Jason
 
Back
Top