We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Make a form stay on another form

EdTheHobo
EdTheHobo asked
on
Medium Priority
260 Views
Last Modified: 2012-05-06
Hi, I was wondering how to make one form stay on top of another form. Example:

I have 2 forms, Form1 and Form2. When the user clicks on form 1, I want Form2 to stay on top of it. Also, I don't want Form2 to be above everything. So if I have a Form3 and they click on it, it will go above forms 1 and 2, but Form2 is still above Form1.

I am using VB6.
Comment
Watch Question

Start a new project with three forms and place a command button on Form1 and Form2.

'Form1 code:
Option Explicit

Private Sub Command1_Click()
    Form2.Show
End Sub

Private Sub Form_Activate()
    If Form2.Visible Then Form2.Show
End Sub

Private Sub Form_Load()
    Load Form2
    Load Form3
End Sub

Private Sub Form_Unload(Cancel As Integer)
    End
End Sub

'Form2 code
Option Explicit

Private Sub Command1_Click()
    Form3.Show
End Sub
Commented:
Without waiting:
Form2.Show(vbModeless, Form1)
With waiting:
Form2.Show(vbModal, Form1)

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
VK

Commented:
And for Form 3:

Without waiting:
Form3.Show(vbModeless, Form2)
With waiting:
Form3.Show(vbModal, Form2)

Author

Commented:
Works perfect ^_^ Thanks.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.