Hi, I am using C#2.0 and working on Winforms. I have two applications(app1,app2). when the app1 runs it will automatically invoke the app2. I have a timer in my app2 and in timer_tick I activate a buttonclick event.But I want this Button Click to be fired only one time when the app is started.
The problem i am facing is for some unknow reason the timer gets fired more than one time even though i make mytimer.Enable= false. Is there a way where i can make timer not be invoked second time. OR Is there a way i can make Button click event fired automatically without using timers.
Here is the code :
private void Form1_Activated(object sender, EventArgs e)
{
mytimer.Interval = 2000;
mytimer.Enabled = true;
mytimer.Tick += new System.EventHandler(timer1_Tick);
}
private void timer1_Tick(object sender, EventArgs e)
{
mytimer.Enabled = false;
button1_Click(this, EventArgs.Empty);
}
private void button1_Click(object sender, EventArgs e)
{
}
Thanks in advacne Madhu