| View previous topic :: View next topic |
| Author |
Message |
TheIndianGuy Advanced Cheater
Reputation: 102
Joined: 14 Jan 2007 Posts: 88
|
Posted: Tue Aug 28, 2007 2:36 pm Post subject: [Visual C# 2005]Help with indicating multiplication - SOLVED |
|
|
i am building an auto typer in C# and im still getting used to C# its a bit different from VB and i was getting used to C# by making some programs i have made in VB and i ran into the problem of telling C# that i wanted to multiply by 1000 using the code "* 1000" but it is telling me i cannot use "*" so what i am asking is for some assistance in finishing my project
the code i am using is
| Code: | private void button1_Click(object sender, EventArgs e)
{
timer1.Interval = textBox1.Text * 1000;
timer1.Enabled = true;
} |
the problem is the "*", if someone could help me fix it that would be great.
Last edited by TheIndianGuy on Tue Aug 28, 2007 2:49 pm; edited 3 times in total |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Tue Aug 28, 2007 2:41 pm Post subject: Re: [Visual C# 2005] Help with indicating multiplication |
|
|
| skate4lifee wrote: | i am building an auto typer in C# and im still getting used to C# its a bit different from VB and i was getting used to C# by making some programs i have made in VB and i ran into the problem of telling C# that i wanted to multiply by 1000 using the code "* 1000" but it is telling me i cannot use "*" so what i am asking is for some assistance in finishing my project
the code i am using is
| Code: | private void button1_Click(object sender, EventArgs e)
{
timer1.Interval = textBox1.Text * 1000;
timer1.Enabled = true;
} |
the problem is the "*", if someone could help me fix it that would be great. |
Try
timer1.Interval = timer1.Interval + Convert.ToInt32(textBox1.Text) * 1000
|
|
| Back to top |
|
 |
TheIndianGuy Advanced Cheater
Reputation: 102
Joined: 14 Jan 2007 Posts: 88
|
Posted: Tue Aug 28, 2007 2:46 pm Post subject: |
|
|
| thank you it works great
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Tue Aug 28, 2007 5:03 pm Post subject: |
|
|
A simpler way to do this is:
| Code: |
private void button1_Click(object sender, EventArgs e)
{
timer1.Interval = int.Parse(textBox1.Text) * 1000;
timer1.Enabled = true;
}
|
This parses the text in textBox1, and sticks it into an int value.
|
|
| Back to top |
|
 |
TheIndianGuy Advanced Cheater
Reputation: 102
Joined: 14 Jan 2007 Posts: 88
|
Posted: Tue Aug 28, 2007 8:51 pm Post subject: |
|
|
| samuri25404 wrote: | A simpler way to do this is:
| Code: |
private void button1_Click(object sender, EventArgs e)
{
timer1.Interval = int.Parse(textBox1.Text) * 1000;
timer1.Enabled = true;
}
|
This parses the text in textBox1, and sticks it into an int value. |
thanks, yeah i agree that is much easier, thats what i wanted to do (stick it into an int value =P)
|
|
| Back to top |
|
 |
|