New to VB Net 2003 - HELP!

thhynes

Member
Joined
Dec 16, 2004
Messages
7
Location
Hartford, CT
Programming Experience
Beginner
Greetings,

First of all before I ask this question I have searched books, the web, and help with in VB to no avail. I did take a course in Visual Basic about 7 years ago and forgot everything...well kind of

Okay my question....

I have a form and a button when the user presses the button I want form1 to disapear and form2 to appear

The code that I have is the following

Form1.hide()
Form2.show() or

Form1.Visible = False
Form2.Visible=True
However I get an error which is

Refrence to a non-shared member requires an object refrence

What am I doing wrong?

Thanks!

Tom
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
dim f2 as new form2
me.hide()
f2.showdialog
me.show()

Note: by using showdialog the sub stops untill the dialog window is closed, thus when form2 is closed form1 will be unhiden.

TPM
 

thhynes

Member
Joined
Dec 16, 2004
Messages
7
Location
Hartford, CT
Programming Experience
Beginner
TPM said:
dim f2 as new form2
me.hide()
f2.showdialog
me.show()

Note: by using showdialog the sub stops untill the dialog window is closed, thus when form2 is closed form1 will be unhiden.

TPM

Hi TPM, I am now taking a class for VB.NET and I was wondering if you could help me out once more....but I want to see if I understand this corretly so bear with me...I'll try to write this as code with explination

' declare new variable

dim f2 as new form2

'hide first form
hide.me() -- this HIDES the first form
f2.showdialog -- I am not sure what this does
me.show -- this shows the 2nd form page

now if I wanted to go backwards do I need to do this? I am just trying to find an easy way to open and close and recall different forms as needed...

dim f1 as new form1
hide().me
f1.showdialog
me.show

The text book and the instructor are just terrible...

signed...not to frustrated anymore :)

Tom
 

ManicCW

Well-known member
Joined
Jul 21, 2005
Messages
428
Location
Mostar
Programming Experience
Beginner
myForm.ShowDialog shows form as dialog and you need to close dialog before you continue to work on main form.

You allways have to declare form as Dim myForm As FormName

Adn you show and hide it using methods: show, hide
 
Top Bottom