buffalonian4
asked on
Form within a Form
I am beginner in VB, and created a main form with a simple command button. What I would like to know is there a way to pull up a secondary form within a display window on the main form as opposed to using MDI parent/child relationship?
Create your second form.
then in the click event for the command button call the show method of the form.
Private Sub Command1_Click()
form1.show
form1.startupposition = 1 'Center Owner Screen
End Sub
then in the click event for the command button call the show method of the form.
Private Sub Command1_Click()
form1.show
form1.startupposition = 1 'Center Owner Screen
End Sub
Based on your title, it sounds like you want aform embedded within another form.
Although you can't do this without MDI, you can add a picturebox or frame to act as a container for more controls, which can then be moved independently of the main form.
Although you can't do this without MDI, you can add a picturebox or frame to act as a container for more controls, which can then be moved independently of the main form.
Maybe use the SetParent API will do.
ASKER
I guess a little clarification is in order. What I am trying to do is create a display window similar to a picture or text box on the main form. When the cmd_click event occurs, I would like to have the second form be pulled up within the "container". It appears the picturebox or frame idea seems like the right approach, however, I am not sure how to pull up the call the second form within the frame. Any ideas.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Rspahitz, thanks, I'll give it a go.
ASKER
This appears to work, although, I think will need to rethink my design functionality. Thanks.
Thanks for the "A". Just curious, which of the three choices did you pick or are you leaning toward?
ASKER
Using the PictureBox was what I went with, however, because of my programming limitation and what I am trying to accomplish, I am rethinking the design. But, as a beginner its the only way to learn through trial and error sometimes. I appreciate your assistance.
for e.g
form2.show vbModal