修改后定时器就不能用了,请问这样修改对吗?
string s = 当前速度.Text;
a = Convert.ToInt32(s);
if (a > 0)
{
timer1.Interval = (470000 / a);
} t = 0;
屏掉timer1.Interval = (470000 / a);就对了 请各位知道,该怎么在程序中修改Interval值的。
string s = 当前速度.Text;
a = Convert.ToInt32(s);
if (a > 0)
{
timer1.Interval = (470000 / a);
} t = 0;
屏掉timer1.Interval = (470000 / a);就对了 请各位知道,该怎么在程序中修改Interval值的。
{
InitializeComponent();
timer.Tick += new EventHandler(timer_Tick);
timer.Interval = 100;
timer.Start();
}
private Timer timer = new Timer();
private void button1_Click(object sender, EventArgs e)
{
timer.Interval = 1000;
}
int i = 0;
void timer_Tick(object sender, EventArgs e)
{
//throw new NotImplementedException();
i++;
this.textBox1.Text = i.ToString();
}是不是你的timer1.Interval 超过最大值了啊?
try{
a = Convert.ToInt32(s);
if (a > 0)
{
timer1.Interval = (470000 / a);
}
}catch(Exception ex){MessageBox.Show("出错");}
t = 0;