rookie VB help requested on something simple

  • Thread starter Thread starter dchaney297
  • Start date Start date
D

dchaney297

Guest
Hello all,

I am a new student to VB and in the class we are using visual studio.net

For my exercise I am required to have a button that will switch between our two programs in our project.

My problem is I cannot figure out the code for that.

My two form names are:

form1.vb, and form2.vb

I know this is something simple, but like I said I am a rookie to VB, and I cannot find it in my textbook.

Thanks all,
David
 
when you say "switch between programs" do you mean between forms?

because if so the answer is probably:

Visual Basic:
form1.Hide
form2.Show
 
AutoCOL said:
when you say "switch between programs" do you mean between forms?

because if so the answer is probably:

Visual Basic:
form1.Hide
form2.Show

Thanks for the super fast reply.

That's what I have, actually this is what I have:

Private Sub btn35_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn35.Click

'Go to form2 for ex. 3.5

Form2.Show()
Form1.Hide()


End Sub

I tried removing the () as per your reply but the compiler adds it back.

But with that code above I get this error message with the code:


"Reference to a non-shared member requires an object reference"

So I'm not sure what that means.

What do you think??

Thanks again
 
Try this one...


dim x as new form2

x.show
me.visible=false


This will show form2 and hide the form that contains you command button.
 
updown said:
Try this one...


dim x as new form2

x.show
me.visible=false


This will show form2 and hide the form that contains you command button.

That seemed to have done it.

Thanks!
 
Also, you could do something more complicated, like i do when switching which is:
(assuming form1 is the one open and form2 has the properties Visible=False and Enabled=False)
Form2.Enabled=True
Form1.Enabled=False
Form1.Visible=False
Form2.Visible=True
 
Ordos0 said:
Also, you could do something more complicated, like i do when switching which is:
(assuming form1 is the one open and form2 has the properties Visible=False and Enabled=False)
Form2.Enabled=True
Form1.Enabled=False
Form1.Visible=False
Form2.Visible=True

Thanks. But I better keep it simple for the time being. <G>

Thanks for all your help.

David
 
Back
Top