kinton
asked on
Add a sub form to a main form in visual basic
Hi,
Can some one explain to me how to add a subform to a main form in visual basic, then in turn link the forms together?
thanks
Can some one explain to me how to add a subform to a main form in visual basic, then in turn link the forms together?
thanks
Also, if you want form2 to show and not be able
to click on form1 while it is active you can do:
form2.show vbModal, form1.hwnd
to click on form1 while it is active you can do:
form2.show vbModal, form1.hwnd
You asked about subforms in VB. VB doesn't support a true subform. You can simulate it as shown above.
mlmcc
mlmcc
It is so simple to do that.
Create a new form using File --> New Form --> give some name to that form( form2.frm)
then write the following code in button click event.
Private Sub Command1_click()
form2.show
form1.hide ' Write this code if you want to hide the first window.
End Sub
Create a new form using File --> New Form --> give some name to that form( form2.frm)
then write the following code in button click event.
Private Sub Command1_click()
form2.show
form1.hide ' Write this code if you want to hide the first window.
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry about the bad explanation of the question, but against all odds Ivan, you knew exactly what I needed. Thanks for your help.
In Form1, when you want to bring up Form2, do:
Form2.Show
If you don't want Form1 to appear while Form2 is up:
Form1.Hide
Form2.Show
When you're done with Form2, do
Form1.Show
And if you want the cursor to be in a particular field:
Form1.Fieldx.SetFocus