Set a boolean variable:
bool await;
Create an object Windows Timer by name(example) awaitTimer, and in your Tick Event add the following code:
private void awaitTimer_Tick(object sender, EventArgs e)
{
awaitTimer.Stop();
await = false;
}
Create a method, here we call Await:
public void Await(int interval)
{
await = true;
awaitTimer.Interval = interval;
awaitTimer.Start();
while (await)
{
Application.DoEvents();
}
}
To use, simply type Await(*), between parentheses put the time you want to wait for the next instruction in milliseconds.
//Events
Await(1000); //1000 para esperar 1 segundo
//Events
excellent Vik, thank you very much! :)
– Gabriel