Application.Idle

R

Rob

How can I write the following code in VB.NET :

private void Form1_Load(object sender, System.EventArgs e)
{
// Submit to Idle event to set controls state at idle time
Application.Idle += new EventHandler(Application_Idle);
}

private void Application_Idle(object sender, EventArgs e)
{
SetStateOfControls();
}

Also is ther a way to turn the Application.Idle on or off with
an on or off button ?
 
H

Herfried K. Wagner [MVP]

Rob said:
How can I write the following code in VB.NET :

private void Form1_Load(object sender, System.EventArgs e)
{
// Submit to Idle event to set controls state at idle time
Application.Idle += new EventHandler(Application_Idle);
}

private void Application_Idle(object sender, EventArgs e)
{
SetStateOfControls();
}

Also is ther a way to turn the Application.Idle on or off with
an on or off button ?

\\\

' Add handler.
AddHandler Application.Idle, AddressOf Me.Application_Idle

' Remove handler.
RemoveHandler Application.Idle, AddressOf Me.Application_Idle
..
..
..
Private Sub Application_Idle(ByVal sender As Object, ByVal e As EventArgs)
...
End Sub
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top