Click here to Skip to main content
15,913,467 members
Home / Discussions / C#
   

C#

 
AnswerRe: MessageBox.Show("Hello, world."); Pin
Luc Pattyn19-Jul-08 9:40
sitebuilderLuc Pattyn19-Jul-08 9:40 
AnswerRe: MessageBox.Show("Hello, world."); Pin
Paul Conrad19-Jul-08 11:03
professionalPaul Conrad19-Jul-08 11:03 
QuestionProblem with program that copies files to new folder Pin
jumbojs19-Jul-08 8:38
jumbojs19-Jul-08 8:38 
AnswerRe: Problem with program that copies files to new folder Pin
Luc Pattyn19-Jul-08 8:50
sitebuilderLuc Pattyn19-Jul-08 8:50 
GeneralRe: Problem with program that copies files to new folder Pin
jumbojs19-Jul-08 9:16
jumbojs19-Jul-08 9:16 
GeneralRe: Problem with program that copies files to new folder Pin
Luc Pattyn19-Jul-08 9:38
sitebuilderLuc Pattyn19-Jul-08 9:38 
GeneralRe: Problem with program that copies files to new folder Pin
jumbojs19-Jul-08 10:09
jumbojs19-Jul-08 10:09 
GeneralRe: Problem with program that copies files to new folder Pin
Luc Pattyn19-Jul-08 10:15
sitebuilderLuc Pattyn19-Jul-08 10:15 
GeneralRe: Problem with program that copies files to new folder Pin
jumbojs19-Jul-08 10:18
jumbojs19-Jul-08 10:18 
GeneralRe: Problem with program that copies files to new folder Pin
Luc Pattyn19-Jul-08 10:32
sitebuilderLuc Pattyn19-Jul-08 10:32 
QuestionCrystal Report -- Urgent Help Pin
Ahmed EL Gendy19-Jul-08 8:29
Ahmed EL Gendy19-Jul-08 8:29 
AnswerRe: Crystal Report -- Urgent Help Pin
Paul Conrad19-Jul-08 11:04
professionalPaul Conrad19-Jul-08 11:04 
QuestionHandles in C# ? Pin
kindman_nb19-Jul-08 8:20
kindman_nb19-Jul-08 8:20 
AnswerRe: Handles in C# ? Pin
Wendelius19-Jul-08 8:31
mentorWendelius19-Jul-08 8:31 
GeneralRe: Handles in C# ? Pin
kindman_nb19-Jul-08 9:08
kindman_nb19-Jul-08 9:08 
GeneralRe: Handles in C# ? Pin
Wendelius19-Jul-08 21:37
mentorWendelius19-Jul-08 21:37 
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 

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.