Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 6, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Make One Form Parent of Another

Prior to VB5, when you wanted to make a form appear on top of another form, you either made it modal or used an MDIForm with children. If you wanted to go beyond that, you had to use API calls. Starting with VB5, you can use the Show method's optional ownerform parameter to set one form as the parent of another. This means you always place the child form-not an MDI child-on top of the parent form, even though the parent form remains active. You can also use the style vbModal parameter to force modality, but that defeats any reason to use ownerform. Here's how you invoke the ownerform parameter, making a form a nonmodal child of a non-MDIForm:

Private Sub Command1_Click()
	Form2.Show , Me
End Sub

Ron Schwarz
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date