DoEvents?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: DoEvents?

  1. #1
    Join Date
    Jul 2005
    Posts
    50

    DoEvents?

    What are DoEvents and how do I use them?

  2. #2
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    as I specified in another thread, type DoEvent and press F1 for help...
    this is the msdn page:

    http://msdn.microsoft.com/library/de...ctdoevents.asp

    after reading that, go to "see also" and "example" at the top of the page

    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  3. #3
    Join Date
    Jul 2005
    Posts
    50
    I don't have MSDN, so I can't do the "F1" method. I still don't understand. Can you give me an example? This is what I though:

    Private Sub Command1_Click()
    Do
    The Event
    DoEvents
    Loop
    End Sub

    Didn't work. Then I tried it without the "DoEvents", but then it makes the event loop without stopping, resulting in me unable to close the application (had to use Crtl+Alt+Delete). What is the correct way to use it?

  4. #4
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    even if you do not have msdn (bad boy bad boy you can ued it online (link I sent in the previous post)
    DoEvents per se doe not do anything, just yelds the execution to all incoming events. After calling DoEvents you have to take some action via code. It is used mostly to stop long executions like (code not tested)

    Code:
    private bStop as boolean
    private sub timer_Ontimer()
        do
             ExecuteSomeCodeButNotForLong '' just few seconds
             DoEvents  '' allows cancel button click to be precessed
             if bStop then exit do
        loop
    end sub
    
    private sub CancelButton_Click()
        bStop = true
    end sub
    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

Similar Threads

  1. Replies: 0
    Last Post: 02-20-2005, 02:06 PM
  2. ASP.NET Community Events Calendar
    By ASPSmith Training in forum dotnet.announcements
    Replies: 0
    Last Post: 06-14-2002, 08:39 PM
  3. COM Interop and Events.
    By Dave in forum .NET
    Replies: 0
    Last Post: 05-15-2002, 10:21 AM
  4. ANN: Trap events in other applications
    By Adelle Hartley in forum vb.announcements
    Replies: 0
    Last Post: 10-09-2001, 11:55 PM
  5. COM+ Events in NT 4.0
    By Brian in forum VB Classic
    Replies: 1
    Last Post: 06-14-2000, 05:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center