Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleMake a form act modal when it is not
Keywordsform, modal, fake modal, dialog
CategoriesControls, Tips and Tricks, Software Engineering
 
In some cases, you may want to display a non-modal form while a modal form is visible. Unfortunately that's not possible. Instead you can use this trick to make a form seem modal when it isn't.

Disable the first form before displaying the second. Use a DoEvents loop to process events while the second form is visible.

Note that this use of DoEvents may cause problems in some circumstances.

 
Private Sub Command1_Click()
    Form2.Show
    Enabled = False
    Do While Form2.Visible
        DoEvents
    Loop
    Unload Form2
    Enabled = True
    SetFocus
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated