Hi,
i am doing a simple application using vb8 and i want to load a form named form2 on my main form(form1) rather than opening form2 in another window..

can anyone please help. Thank you.

Recommended Answers

All 6 Replies

On your form1, create a command button. then try this code:

Sub Command1_click()

form1.hide 'closes the form1
form2.show 'loads the form2

End Sub


Hope it could help... ^_^v..

:)
Thanks for the help but i am trying to display form2 on form1 itself, rather than to hide form1 and show form2..;)

Then use MDI form as main form.

Sub Command1_click()

form2.show 'loads the form2

End Sub

That should do it..

Why do you want to open the 2nd form in the 1st form? Surely it's better to just close form1 and open form 2?

Your main form(Form1) should be MDI Form, then set your form2's MDIChild property TRUE, then do Form2.show without hide or close your Form1.

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.