|
-
February 5th, 2000, 08:01 AM
#1
Inserting a Form into Another form
Hi All:
I would like to insert one form into another form. Is this possible? Lets say I have a master form named frmMain and three other forms with names form1, form2 and form3. The master form has some form selection menus to select which form to load. Is it possible for me to load/unload the forms in the master form (frmMain)? I have attempted using the OLE object control in frmMain. However, only the icon and name of the other forms are displayed in the OLE control (in frmMain).
I have never seen any articles on this issue.
Sincerely,
Hansel
[email protected]
-
February 5th, 2000, 09:14 AM
#2
Re: Inserting a Form into Another form
What about using MDI?
Vlad
-
February 5th, 2000, 01:39 PM
#3
Re: Inserting a Form into Another form
I've thought of using MDI. However, I don't get the effect I want. Form instance, I have frmMain as having controls embedded within and to the right of the controls I would like to insert my one of my forms. It must be fixed within its display frame (not moveable or sizeable).
Sincerely,
Hansel
[email protected]
-
February 5th, 2000, 09:48 PM
#4
Re: Inserting a Form into Another form
If I undenrstand correctly it's simple: Set BorderStyle property for your second form to None and display it with statement Form2.Show vbModal, Form1. In Form2_Load event set Left and Top properties to position it in an appropriate place. I'm using this technique very often to display some kind of additional choices, for example the form has Combobox to select the type of customer, but it doesn't have some particular type of customer. Double click on that combo dislays the form which allows to enter a new type of customer. And second method is to create ActiveX control containing all controls you need and to use it instead of regular controls.
Vlad
-
February 6th, 2000, 06:00 AM
#5
Re: Inserting a Form into Another form
Modify the windowstyle of form1 etc. using SetWindowLong and add the WS_CHILD style, then use SetParent to put it in your main form. I usually have a picturebox in which I show the form.
Something like this:
public Sub Make_Child_Window(ParenthWnd as Long, ChildhWnd as Long)
Dim lStyle as Long
lStyle = GetWindowLong(ChildhWnd, GWL_STYLE)
lStyle = lStyle Or WS_CHILD
Call SetWindowLong(ChildhWnd, GWL_STYLE, lStyle)
Call SetParent(ChildhWnd, ParenthWnd)
End Sub
Crazy D :-)
"One ring rules them all"
-
February 7th, 2000, 06:14 PM
#6
Re: Inserting a Form into Another form
Hey:
Your suggestion is good and useful were one needs to add functionality to a form. However, in my instance, setting the displayed form to modal prevents access to the parent form and so one will not be able to select another form (unless the displayed form is closed).
I have also tried CrazyD's suggestion, which is more in line with what I require. You should give it a try. Thanks all the same.
Sincerely,
Hansel
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|