Link to home
Start Free TrialLog in
Avatar of buffalonian4
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?
Avatar of RAJz
RAJz

use the second form as vbmodal

for e.g
form2.show vbModal

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

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.
Avatar of Ryan Chong
Maybe use the SetParent API will do.
Avatar of buffalonian4

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
Avatar of rspahitz
rspahitz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Rspahitz, thanks, I'll give it a go.  
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?
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.