Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

?subForms in VB6

Status
Not open for further replies.

weinem01

Programmer
Jun 25, 2001
13
US
I'm writing a vb6 database application that I would like to model after the Form/subForm design in Access. I've created the subforms and set their borderstyle = 0 property so there is no title bar and it appears that the subform is part of the main form. I have one large form that has the parent recordset information in it and then each child recordset has its own form. I use the zorder(0) method to keep the subform on top, so it doesn't disappear behind the main form when the mainform receives focus. The problem is that with the zorder(0) method, the main form cannot get focus and the record navigation buttons don't work at all. Does anyone have any experience with this design technique in visual basic?

Thanks,

Matt Weiner
 
If I understand what I'm reading correctly, you might want to try using an MDI form in VB6. You can add one in by right clicking in the Project Explorer window, select add, and the click the MDI Form from the flyout menu. This will serve as your parent form.

On each subform that you would like to have , set the subform's MDIChild property to true. This will automatically put the subForm on top, and inside of the MDI Form.

If you would like to have more than one form within the parent form at the same time, all you have to do is set the width and height property of them.

If this is too vague of an explanation, please let me know, and I'll try to put in some sort of sample code. Good Luck. "The night sky over the planet Krikkit is the least interesting sight in the entire universe."

-Hitch Hiker's Guide To The Galaxy
 
Is there a reason why you need to use 2 forms? Could you use a picturebox to simulate the subform, and just put controls inside that?
 
You could do it that way, but the usage of the MDI parent/child forms is much more structured, and easier to follow.

Take, for example, a database with an employees table, a department table, and a management table. If using MDI forms with child forms, you could easily have a combination of an Employee form displayed along with a Department form. You could have a Management form displayed along with a Department form, or you could have all three forms displayed together.

If using the picture box control, you would have to create different forms for each combination. Meaning, for the above example, to get the same functionality out of the picture boxes as the MDI child forms, you would actually have to create about 6 seperate forms, whearas with MDI forms, you would only have to create 3. "The night sky over the planet Krikkit is the least interesting sight in the entire universe."

-Hitch Hiker's Guide To The Galaxy
 
Thanks everyone. MDI forms seem to have done the trick.

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top