|
-
Jun 19th, 2009, 04:57 PM
#1
Thread Starter
Addicted Member
Timer interval
Im new to C#, i went from VB to C#, so this is completly new for me.
I want the timer1.interval to be the value of a textbox.
Something like this i guess
Code:
timer1.Interval = (textBox2.value);
But it dosent work..
Can anybody help me? =)
-
Jun 19th, 2009, 10:24 PM
#2
Addicted Member
Re: Timer interval
To get the value of a textbox it is no different from VB to C#. textBox2.Text
And the Timer.Interval property receives an Integer value so you should also cast it:
timer1.Interval = (int)textBox2.Text;
If someone has helped you, please make sure to rate them. 
-
Jun 20th, 2009, 11:08 AM
#3
Thread Starter
Addicted Member
Last edited by Eldrup; Jun 20th, 2009 at 11:18 AM.
Eldrup
-
Jun 20th, 2009, 11:45 AM
#4
Member
Re: Timer interval
Code:
timer1.Interval = Convert.ToInt32(textBox2.Text);
-
Jun 20th, 2009, 04:48 PM
#5
Thread Starter
Addicted Member
-
Jun 23rd, 2009, 07:21 PM
#6
Frenzied Member
Re: Timer interval
Remember when using Timer Intervals:
500 = half a second
1000 = 1 second
2000 = 2 seconds
etc...
-
Jun 27th, 2009, 02:31 AM
#7
Re: Timer interval
You should be using Parse, or better yet TryParse for conversion of strings to integers.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|