Lost Password?


  #1 (permalink)  
Old 07-18-2006, 09:50 AM
Viper's Avatar   
Viper Viper is offline
Newbie
 
Join Date: Jul 2006
Posts: 15
Rep Power: 9
Viper is on a distinguished road
Default Problem adding timer in a text box

Good day all

I do not know what is the control to add the time in my text box? I have made a window form application simple game that you have to click buttons for 30 seconds. The application works except to view the time.

I think I did put the textBox2 line at the right place but I don't know what to write as command after in order to see the variable "intTimerCounter"?

Here is part of the code and I have put question mark where I seem to miss info.

private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e)
{
// Update the timer
intTimerCounter++;
textBox2->???? = intTimerCounter;
if( intTimerCounter == 30 )
{
// If the timer reaches 30, disable
// the buttons
button1->Enabled = false;
button2->Enabled = false;

Thank you in advance

Last edited by Viper; 07-18-2006 at 09:52 AM. Reason: I'm french and now it will sounds better
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 07-18-2006, 10:07 AM
NeedHelp NeedHelp is offline
Programming God
 
Join Date: May 2006
Posts: 527
Rep Power: 13
NeedHelp is on a distinguished road
Default

Ahh, this is managed C++? .NET 2.0?
Your timer interval is in seconds and you just want to display time left?

Code:
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e)
{
// Update the timer
intTimerCounter++;


textBox2->Text = System::ConvertToString(30 - intTimerCounter);


if( intTimerCounter == 30 )
{
// If the timer reaches 30, disable
// the buttons
button1->Enabled = false;
button2->Enabled = false;
__________________
I Need Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-18-2006, 10:36 AM
Viper's Avatar   
Viper Viper is offline
Newbie
 
Join Date: Jul 2006
Posts: 15
Rep Power: 9
Viper is on a distinguished road
Default

Thanks NeedHelp

Your line make sense. I changed "ConvertToString" to "Convert" since Intellisense does not recognize ConvertToString. I did both but came with an error.
The command textBox2->Text is to see text only. Would it be another command to see a variable or a timer in a text box?

P.S. Sorry I see my post should have been in the Managed C++. Maybe a MODO could transfer my post.

Thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-18-2006, 11:21 AM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 9,648
Last Blog:
PHP Objects, Patterns,...
Rep Power: 20
Jordan is just really niceJordan is just really niceJordan is just really niceJordan is just really nice
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

Hey Viper,
I just loaded VC++ 2005 (.NET 2.0) and textBox1->Text is correct.
Here is the function I used:

Code:
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
	textBox1->Text = "Test";
}
He does have the Convert wrong. It should be Convert::ToString();

Code:
textBox2->Text = Convert::ToString(30 - intTimerCounter);
PS: Moving to Managed C++ Forum
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-18-2006, 01:38 PM
Viper's Avatar   
Viper Viper is offline
Newbie
 
Join Date: Jul 2006
Posts: 15
Rep Power: 9
Viper is on a distinguished road
Default

It works

Thank you NeedHelp and Jordan, I really appreciated your help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 09-23-2006, 12:10 AM
dirkfirst dirkfirst is offline
Programming Professional
 
Join Date: May 2006
Posts: 338
Rep Power: 12
dirkfirst is on a distinguished road
Default

Just out of curiosity, what were you creating?
__________________
DirkFirst
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 09-24-2006, 09:21 PM
Viper's Avatar   
Viper Viper is offline
Newbie
 
Join Date: Jul 2006
Posts: 15
Rep Power: 9
Viper is on a distinguished road
Default

Three buttons: start, left and right
Simply a windows with two buttons that you click in intervals for 30 sec after pressing the start button.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[C] Comparison problem Alhazred C and C++ 1 08-29-2007 05:58 AM
HTML table vertical aligning problem Carrym HTML Programming 2 03-22-2007 11:04 PM
HTML Basic Formatting clookid Tutorials 14 03-06-2007 04:10 PM
Glass text - Photoshop ahsan16 Photoshop Tutorials 3 01-11-2007 11:35 PM
Generate text with transparent background AfTriX PHP Tutorials 1 01-08-2007 03:13 AM


All times are GMT -5. The time now is 05:30 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads