This seems so simple, so why can't I figure out how to do it?

All I want to do is have two forms, and if you click a button on Form1, Form2 will load (replaying Form1). In a Windows App.

How ????

Thanks for any help.

well if im understanding what you want all you would have to do is is use the formname.show to show the other form and a me.hide to hide the current forums. so kind of like this

Private Sub cmdbutton1()
   form2.show
   me.hide
End Sub

how to link forms sql with vb?????

What do u mean by forms sql ?

Please clarify for further detail explanation.

i tried the code above and its working...
i love it!!!
i lean something from this site... hope i could learn more...
im sure... pretty sure... xD

:-/ :confused: All I want to do is have two forms, and if you click a button on Form1, Form2 will loaded
Any help plz

I'm making a system and need to link one form to another. meaning- say --> I click login---another form comes up allowing the user to login......how to do dat'?

You need to read Post #2.

'If Form1 is currently showing on your screen, click the command1 button to load your other form (frmLogin)

frmLogin.Show 1 '1 is vbModal, in other words, the top most form that will have the focus above any other forms.

Unload Me 'Where Me = your first form (Form1)

AndreRet,

The code you provided will end the application (if there are only two forms) and I'll tell you why...

When you go Form2.Show vbModal from Form1, code execution stops in Form1 and begins in Form2, because of this, Form1 is now not accessible because Form2 has been shown modal. The only way to have the next line of code execute in form1 is unloading form2 and once you do, Form1 unloads.

vb5prgrmr,

You are so right. You know the saying "No Brain No Gain". Exactly what happened here. Did not think it through now did I?

Should have used something like "Me.Hide" etc.

Thanks for pointing this out...

commented: "No Brain No Gain" -> :) +10

well if im understanding what you want all you would have to do is is use the formname.show to show the other form and a me.hide to hide the current forums. so kind of like this

Private Sub cmdbutton1()
   form2.show
   me.hide
End Sub

You are actually the most amazing person ever THANKYOU!!!!!!!!! you totally just saved my AS-coursework project :)

thank you for the information...i know now how to links form..i got it.

Poster #3 : Please don't bump threads, start your own.

Please mark thread as solved

If the first form is clicked, then the second form should appear. So type this code for the first form.
Private Sub Form_Click() form2.show me.hide End Sub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.