Monday, January 5, 2009

Basic Techniques Of VB Part Three

DoEvents
DoEvents method will return control to the operating system for a while so that the operating system can process the events that may occur. This method is appropriate if the code is implemented in a program that requires long process so that another event that could have waited precedence.

Examples of the process DoEvents Iterations (loop) can be seen below:

For i = 1 To 300
Text1.Text = i
DoEvents
'Inner loop a long time
For j = 1 To 100000
Next j
Next i
Text1.Text = "ok"

However, DoEvents is not a solution without potential problems. For example, if you call a method, you must ensure that the method is not called back until the execution is returned.

0 comments: