我在app.config中写了个取timer值
<add key="Timer" value="10000"/>
现在在事件中,取app.config中的Timer,怎么进行类型转化?
InitializeComponent();
            timer1.Interval =10000;把这个10000换成app.config中的Timer   (System.Configuration.ConfigurationManager.AppSettings["Timer"].ToString();)
            timer1.Enabled = true;
            timer1.Start();
也就是说只要在app.confing中该时间就可以了

解决方案 »

  1.   

    timer1.Interval = Convert.ToDouble(ConfigurationManager.AppSettings["Timer"]);
      

  2.   

    timer1.Interval = Convert.ToInt32(ConfigurationManager.AppSettings["Timer"]);
      

  3.   

    timer1.Interval = Convert.ToInt32(ConfigurationManager.AppSettings["Timer"]);Interval 属性值
    类型:System.Int32
    Int32 指定在相对于上一次发生的 Tick 事件引发 Tick 事件之前的毫秒数。 该值不能小于 1。 http://msdn.microsoft.com/zh-cn/library/system.windows.forms.timer.interval(v=VS.100).aspx