Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
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
 
 
 
TitleIgnore events during a long process by disabling the form
Keywordsignore events, events, disable
CategoriesTips and Tricks, Controls
 
Disable the form(s) whose events you want to ignore.

This example sets the form's Enabled property to False and then starts a 5 second countdown. All events are ignored until the count finishes and the program sets Enabled to True.

 
Private Sub Command1_Click()
    Enabled = False ' Disable the form.
    Screen.MousePointer = vbHourglass
    Label1.Caption = "5"
    m_Count = 5
    DoEvents

    Timer1.Enabled = True
End Sub

' Count down from 5.
Private Sub Timer1_Timer()
    m_Count = m_Count - 1
    Label1.Caption = Format$(m_Count)

    If m_Count = 0 Then
        Timer1.Enabled = False
        Enabled = True  ' Enable the form
        Screen.MousePointer = Default
    End If
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated