修改后定时器就不能用了,请问这样修改对吗?
string s = 当前速度.Text;
                a = Convert.ToInt32(s);
                if (a > 0)
                {
                   timer1.Interval = (470000 / a);
                }                t = 0;
屏掉timer1.Interval = (470000 / a);就对了 请各位知道,该怎么在程序中修改Interval值的。

解决方案 »

  1.   

    好用的啊        public Form1()
            {
                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 超过最大值了啊?
      

  2.   

    测试了下,没啥问题。不过timer1.Interval不能设置小于1的值。小于1了就会停了。
      

  3.   

    string s = 当前速度.Text;
    try{
      a = Convert.ToInt32(s);
      if (a > 0)
      {
      timer1.Interval = (470000 / a);
      }
    }catch(Exception ex){MessageBox.Show("出错");}
      t = 0;
      

  4.   

    timer1.Interval不能太小,但是可以很大..