• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

Make a form stay on another form

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.
0
EdTheHobo
Asked:
EdTheHobo
  • 2
1 Solution
 
Antagony1960Commented:
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
0
 
VKCommented:
Without waiting:
Form2.Show(vbModeless, Form1)
With waiting:
Form2.Show(vbModal, Form1)
0
 
VKCommented:
And for Form 3:

Without waiting:
Form3.Show(vbModeless, Form2)
With waiting:
Form3.Show(vbModal, Form2)
0
 
EdTheHoboAuthor Commented:
Works perfect ^_^ Thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now