Welcome to Dream.In.Code
Become a VB Expert!

Join 149,979 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,374 people online right now. Registration is fast and FREE... Join Now!




help vb7

 
Reply to this topicStart new topic

help vb7

koolaroo
17 Dec, 2007 - 07:58 AM
Post #1

New D.I.C Head
*

Joined: 10 Dec, 2007
Posts: 18


My Contributions
can someone give me the code to make a button Switch between form1 and form2.
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Help Vb7
17 Dec, 2007 - 09:30 AM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,655



Thanked: 313 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Can you clarify what you mean by switch between? Do you mean have a button on one form launch another form? Or when you click it, it hides the current form and shows another form? Any clarification would help. Thanks! smile.gif
User is offlineProfile CardPM
+Quote Post

koolaroo
RE: Help Vb7
17 Dec, 2007 - 10:47 AM
Post #3

New D.I.C Head
*

Joined: 10 Dec, 2007
Posts: 18


My Contributions
QUOTE(Martyr2 @ 17 Dec, 2007 - 10:30 AM) *

Can you clarify what you mean by switch between? Do you mean have a button on one form launch another form? Or when you click it, it hides the current form and shows another form? Any clarification would help. Thanks! smile.gif

when you click on it it hides the curren form and shows another form
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Help Vb7
17 Dec, 2007 - 10:53 AM
Post #4

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,655



Thanked: 313 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Simple enough...

CODE

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        ' Declare a variable of the other form's type. In this case Form2.
        Dim myotherform As New Form2

        ' Show that form
        myotherform.Show()

        ' Hide the current form.
        Me.Hide()
End Sub


As you can see we declare a variable of type form2, we call its show method to show the form, then we hide the current form. The result is that we change forms.

Hope that is what you were looking for. Enjoy! smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 06:59PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month