to trigger some actions after form load.
-
Hi, I want to do some actions immdiately after the form load automatically. How do I do it. If I do in form load then it happens before the form is loaded. But I want to do after the form is loaded. How do I do it..Thanks.
Hi! One solution could be to attach an event handler for Application.Idle in the Load event handler and then perform your work there:
private void myForm_Load(object sender, EventArgs e)
{
// Do whatever you need when the form is loaded
Application.Idle += new EventHandler(app_Idle);
}
private void app_Idle(object sender, EventArgs e)
{
Application.Idle -= new EventHandler(app_Idle);
MessageBox.Show("This happens almost immediately after myForm_Load has returned!");
}Regards, mav
-
Hi! One solution could be to attach an event handler for Application.Idle in the Load event handler and then perform your work there:
private void myForm_Load(object sender, EventArgs e)
{
// Do whatever you need when the form is loaded
Application.Idle += new EventHandler(app_Idle);
}
private void app_Idle(object sender, EventArgs e)
{
Application.Idle -= new EventHandler(app_Idle);
MessageBox.Show("This happens almost immediately after myForm_Load has returned!");
}Regards, mav
-
Hi! One solution could be to attach an event handler for Application.Idle in the Load event handler and then perform your work there:
private void myForm_Load(object sender, EventArgs e)
{
// Do whatever you need when the form is loaded
Application.Idle += new EventHandler(app_Idle);
}
private void app_Idle(object sender, EventArgs e)
{
Application.Idle -= new EventHandler(app_Idle);
MessageBox.Show("This happens almost immediately after myForm_Load has returned!");
}Regards, mav
-
Hi! One solution could be to attach an event handler for Application.Idle in the Load event handler and then perform your work there:
private void myForm_Load(object sender, EventArgs e)
{
// Do whatever you need when the form is loaded
Application.Idle += new EventHandler(app_Idle);
}
private void app_Idle(object sender, EventArgs e)
{
Application.Idle -= new EventHandler(app_Idle);
MessageBox.Show("This happens almost immediately after myForm_Load has returned!");
}Regards, mav
Perfectly working. Thanks a lot. :thumbsup: