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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is equivalent to Access subform control in VB?

Status
Not open for further replies.

insanevbr

Programmer
Oct 10, 2002
8
0
0
US
Hi All,

What is the equivalent control in VB for an MS Access subform control?

Thanks
 
Having used Access quite a bit, I think I know what you are asking, and the answer is, "There isn't one". You cannot insert an already created form as a control on another form. However, you can use a PictureBox control as a container for other controls, in effect making it a sub-form. You can have several Picture boxes, each with their own set of controls, and hide and unhide them dynamically, allowing you to, in effect, display several different "sub-forms" in the same area, based on run-time logic.

Also look into using the Tab control, which allows you to create sets of controls on each tab, and then switch which tab is visible at any moment, just as you would do manually with multiple Picture Boxes.

But it really depends on what you are wanting to do. If you just want to display a grid of data, use a DataGrid control and a Data control to bind to.

If this doesn't help, let us know what it is you want to accomplish, and we can give you some ideas on how to accomplish it.

Happy Thanksgiving!
 
Everything is hard-coded with VB. LlomaxX's suggestion is sufficient. But, if you would want to use a simulated "subform" on more than one instance, better revert to the UserControl.
 
Somebody correct me if I'm wrong here ...

Subform in VB implies using the DataRepeater control but the DataRepeater control can only display a control contained in an OCX (custom-designed in another project via UserControls). So if you have a fairly complex app with multiple types of subforms, you have to create an OCX with multiple UserControls to handle all the subforms and ensure that that OCX registers itself. If you have to alter your subforms, you have to recompile the OCX and have the user re-register it. I think the DataRepeater, if my assumptions are correct, is a poor solution to a common VB problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top