日期:2014-05-19  浏览次数:20845 次

timer事件不起作用--大家过来看看阿
开始的时候,我把它放在了timer函数里面
没有执行
然后放在这个里面,可是没有执行
time_Elapsed   函数
怎么回事啊
if(this.button1.Text== "実行 ")
{//02

if(this.comboBox1.Text.Trim()== " ")
{
MessageBox.Show( "excelの名前を選択ください ", "★提示★ ");
}
else
{
OleDbConnection   odonn=conn();
string   str= "select   *   from   [ "+this.comboBox1.Text.Trim()+ "] ";//[sheet1$] ";
OleDbDataAdapter   MyCommand   =   new   OleDbDataAdapter(str,odonn);
//DataSet   Ds   =   new   DataSet();
MyCommand.Fill(ds, "NameTB ");
//MessageBox.Show( "sdasda ");
dt=ds.Tables[0];
//dt.Select( "F1 <> ' ' ");
this.dataGrid1.DataSource=ds.Tables[0];


this.button1.Visible=false;
this.comboBox1.Visible=false;
//timer();
time.Elapsed+=new   System.Timers.ElapsedEventHandler(time_Elapsed);
time.Interval=spead   *1000;

time.Enabled=true;
time.Start();
}

------解决方案--------------------
//timer();
time.Elapsed+=new System.Timers.ElapsedEventHandler(time_Elapsed);

你的是啥版本??这个方法没有看到过阿
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
------解决方案--------------------
timer.Tick +=
------解决方案--------------------
windows service是服务程序,运行时,一般用系统时间记时~
winform上的timer,在winform程序运行时才生效,我是这样理解的~^_^