关于C#timer类出错

[复制链接]
查看11 | 回复3 | 2009-7-6 15:35:50 | 显示全部楼层 |阅读模式
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Threading;
public partial class _Default : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)

{

System.Timers.Timer time = new System.Timers.Timer();

time.Interval = 1000;

time.Elapsed += new System.Timers.ElapsedEventHandler(time_Elapsed);

time.AutoReset = true;

time.Enabled = true;



}

public void time_Elapsed(object sender, System.Timers.ElapsedEventArgs e)

{



Label1.Text = "哈哈哈哈哈";

throw new NotImplementedException();

}
}
报错提示 未实现该方法或操作。

回复

使用道具 举报

千问 | 2009-7-6 15:35:50 | 显示全部楼层
public void time_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
Label1.Text = "哈哈哈哈哈";
throw new NotImplementedException(); // 这句,搞定啊,兄弟
}...
回复

使用道具 举报

千问 | 2009-7-6 15:35:50 | 显示全部楼层
你自己抛得异常,去掉就可以啦throw new NotImplementedException();...
回复

使用道具 举报

千问 | 2009-7-6 15:35:50 | 显示全部楼层
没用过,关注中,只用time_tick...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行