Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy question about multiple forms

Status
Not open for further replies.

CompCop911

Programmer
Jun 9, 2004
33
CA
Hi, I am making a Windows app, and i have different forms, and I was wondering how to switch between them using a menu (menu as in a menu below the title bar, like File, Edit, etc)

I tried the following...

If Me.menuItem2.Checked = True Then
MainForm.Form.Visible = False
Form1.Visible = True
End If

and that gave an error "Form" is not a member of My_Project.MainForm

I tried

If Me.menuItem2.Checked = True Then
MainForm.Visible = False
Form1.Visible = True
End If

Error: Reference to a non-shared member requires an object reference.

I am not sure how to fix these errors, can anyone help?

I understand that even though I want different functions (update profile, contact webmaster, etc) I can have them on the same form in separate Tabpages....well, heres the problem.

I managed to add a TabControl, but I don't know how to add TabPages to it! Can anyone help with that? It may be easier than using the "menu-to-go-to-different-forms" method
 
Never mind, I found tab pages...kicked myself cause I didnt notice it...

But does anyone have an answer to switch between forms?
 
MainForm.Visible = False

Is MainForm the type, or the variable of type MainForm?

Because you'll get this error when attempting to call an instance-method on the class itself (which would normally require the method to be declared as being shared).

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
I thought I had replied to this topic, but I got it

in Form1.vb, there was a typo in the namespace lol...(damn all these problems that I figure out myself and then I end up hitting myself becuase of it :p)
 
You should get a VB.Net book if you don't have one already.
 
Just got one, thats how I'm figuring out how to fix these things :D

ComputerCop911
ASP and HTML Programmer
Learning VB.NET and ASP.NET
Can also help with hardware probs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top