DoEvents Method


DoEvents Method

Location

My.Application.DoEvents

Syntax

     My.Application.DoEvents(  ) 

Description

The DoEvents method temporarily relinquishes control from the current block of code so that other pending Windows messages can be processed. Using this method in a block of processing-intensive code can make your application feel more responsive. In some instances, it may be better to use multiple threads within your application to achieve this same goal.

Messages in the message queue for your application are normally processed one at a time by event handlers. If you take a long time to complete processing for a single message, all other messages in the queue will be blocked until the active event completes. Using the DoEvents method allows these other messages to be processed.

Usage at a Glance

  • This method is only valid in Windows Forms applications.

  • When DoEvents is called from an event handler, it is possible that one of the messages being handled will also call the same event handler.

Related Framework Entries

  • System.Windows.Forms.Application.DoEvents Method

See Also

Application Object




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net