Click here to Skip to main content
15,890,438 members
Home / Discussions / C#
   

C#

 
AnswerRe: Handles in C# ? Pin
Luc Pattyn19-Jul-08 8:53
sitebuilderLuc Pattyn19-Jul-08 8:53 
GeneralRe: Handles in C# ? Pin
kindman_nb19-Jul-08 9:12
kindman_nb19-Jul-08 9:12 
GeneralRe: Handles in C# ? Pin
Luc Pattyn19-Jul-08 9:26
sitebuilderLuc Pattyn19-Jul-08 9:26 
QuestionMDI Forms and focus frustration, please help Pin
kensai19-Jul-08 6:56
kensai19-Jul-08 6:56 
AnswerRe: MDI Forms and focus frustration, please help Pin
kensai21-Jul-08 20:55
kensai21-Jul-08 20:55 
QuestionAvoid Horizontal Scrollbars in Frameset using C# Pin
satyaanand.andra@gmail.com19-Jul-08 2:44
satyaanand.andra@gmail.com19-Jul-08 2:44 
Answer[Off Topic/Wrong Forum] Re: Avoid Horizontal Scrollbars in Frameset using C# Pin
Scott Dorman19-Jul-08 4:06
professionalScott Dorman19-Jul-08 4:06 
QuestionProblem with handling Timer Pin
Faysal19-Jul-08 2:09
Faysal19-Jul-08 2:09 
Hi All,
I am facing a vary basic problem with timer. I want a timer to start counting an integer i with a start-button-press and stop counting with a stop-button-press. Then start counting again with start-button-press and so on. The code looks like the following sample snippet:

int i=0;
Timer tmrTest = new Timer();

public void OnTimerEvent_test(object source, EventArgs e)
{
   i++;
   txtCounter.Text = i.ToString();
}

private void btnStartTimer_Click(object sender, EventArgs e)
{
   tmrTest.Enabled = true;
   tmrTest.Interval = 500;
   tmrTest.Tick += new System.EventHandler(OnTimerEvent_test);
}

private void btnStopTimer_Click(object sender, EventArgs e)
{
   tmrTest.Enabled = false;
}


The problem is on start-button-press first time it counts i as i+1 but in second start-button-press it counts i as i+2, for 3rd it's i+3 and so on. But I want the counting to be always i=i+1;

May be this is a very simple issue while handling timer but I failed to get any solution. Please help me to solve this out. And tell me the reason, why is this timer behaving like this?

Thanks in advance
Faysal
AnswerRe: Problem with handling Timer Pin
Luc Pattyn19-Jul-08 2:20
sitebuilderLuc Pattyn19-Jul-08 2:20 
Questionhow to make css builder Pin
mahmoud wafy19-Jul-08 1:46
mahmoud wafy19-Jul-08 1:46 
AnswerRe: how to make css builder Pin
Guffa19-Jul-08 6:29
Guffa19-Jul-08 6:29 
QuestionHow to align Indian Language Marathi text in Crystal Report Pin
UpwardMF19-Jul-08 1:25
UpwardMF19-Jul-08 1:25 
Questionsetup and deploment wiindows application Pin
vishnukamath19-Jul-08 1:03
vishnukamath19-Jul-08 1:03 
QuestionExpire Date For Program? Pin
sitnet18-Jul-08 23:46
sitnet18-Jul-08 23:46 
QuestionMultiCast Group range Pin
DeepOceans18-Jul-08 23:36
DeepOceans18-Jul-08 23:36 
Questionhow to write to css file? Pin
mahmoud wafy18-Jul-08 23:19
mahmoud wafy18-Jul-08 23:19 
Questionindex was outside the bounds of the array Pin
NewToAspDotNet18-Jul-08 23:07
NewToAspDotNet18-Jul-08 23:07 
AnswerRe: index was outside the bounds of the array Pin
Mbah Dhaim19-Jul-08 0:39
Mbah Dhaim19-Jul-08 0:39 
Questionweb application to windows application format Pin
Member 387988118-Jul-08 21:39
Member 387988118-Jul-08 21:39 
Questionlistbox Pin
netJP12L18-Jul-08 19:40
netJP12L18-Jul-08 19:40 
AnswerRe: listbox Pin
Mbah Dhaim19-Jul-08 0:58
Mbah Dhaim19-Jul-08 0:58 
AnswerRe: listbox Pin
Luc Pattyn19-Jul-08 1:40
sitebuilderLuc Pattyn19-Jul-08 1:40 
QuestionFile Expire ? Pin
sitnet18-Jul-08 19:02
sitnet18-Jul-08 19:02 
AnswerRe: File Expire ? Pin
N a v a n e e t h18-Jul-08 19:58
N a v a n e e t h18-Jul-08 19:58 
QuestionRe: File Expire ? Pin
sitnet18-Jul-08 23:42
sitnet18-Jul-08 23:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.