{
System.Timers.Timer aTimer = new System.Timers.Timer();
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
aTimer.Start();
aTimer.Interval = 1000;
aTimer.Enabled = true;
}and call it
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
try
{
foreach (System.Int32 i in Enum.GetValues(typeof(Keys)))
{
if (GetAsyncKeyState(i) == -32767)
{
if (Keys.Control == Control.ModifierKeys) Form1.crtl = 1;
if (Keys.K == (Keys)i) Form1.k = 1;
}
if (Form1.k == 1 && Form1.crtl == 1)
{
string response = ShowDialog("Password Required: ", "Password");
if (response.Equals("###########"))
{
Form1 frm = new Form1();
frm.Show();
Form1.k = 0;
Form1.crtl = 0;
}
}
else
{
Form1.k = 0;
Form1.crtl = 0;
}
}
}
catch (Exception)
{
}
finally
{
}
}
but in this case my show dialog form is open but again and again can any one help for this
my simple task is after show Dialog my timer will be stop
but in this case my show dialog form is open but again and again can any one help for this
my simple task is after show Dialog my timer will be stop

Guest UserPosted Mar 11, 2015, 5:48 AM
Aditya ChauhanPosted Mar 11, 2015, 1:47 AM
Guest UserPosted Mar 10, 2015, 11:12 AM
Aditya ChauhanPosted Mar 10, 2015, 9:15 AM
when i start it it will show my dialog form but timer is execute again and again
i want to stop my timer when my dialog box is open..
how can we stop it in defined event
Guest UserPosted Mar 10, 2015, 7:14 AM
Aditya ChauhanPosted Mar 10, 2015, 5:33 AM
Guest UserPosted Mar 10, 2015, 3:46 AM