Click to See Complete Forum and Search --> : display countdown timer in text box


0binary1
January 22nd, 2009, 01:06 PM
Hello everybody,
I'm new to C++. I am using microsoft C++ 2005 express edition. I have set a timer to 30 seconds. I need to display a countdown timer in a text box but can't figure out how. It is a college project and I asked my instructor for help and he says I'm close, but won't give me the answer. Here's the line of code I'm using:
textBox2->Text = System::Convert::ToString(30-intTimerCounter);
If you'd like to see my full code, just ask. I'm not new to programming, just C++. I'm experienced in Visual Basic and HTML coding. I have spent a few hours trying to figure this out and am starting to get frustrated.
Thanks in advance,
.bin

cilu
January 26th, 2009, 03:37 AM
You need a second timer, or actually, you need to change the existing one.

Let's say you want to do something every 30 seconds, but what to show the elapsed time each second. Then you start a timer with 1 second elapsed time, and when you start it you set a counter to 30. Each time the timer elapses (every second) you decrement the counter and show it's value in the text box. When the counter reaches 0, in addition you do that action you want each 30 seconds, and reset the counter to 30.

thefalcon79
April 4th, 2009, 01:02 PM
hi 0binary1
can u share with us ur code ?
i need to do the same function, count down timer in a text box.

thnx