代码?
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)
http://feiyun0112.cnblogs.com/
解决方案 »
- 这个基类、派生类、析构函数考试题!急,跪求呀!!!!
- string filename = Guid.NewGuid().ToString();
- 线程启动的困惑
- 【S】【O】【S】
- C++结构体转义到C#中,在线等
- 不知道这算不算VS2005 BUG
- 水晶报表10与vs2003是否匹配
- 超简单,我是初学者!
- http://www.netyi.net/in.asp?id=lglchf :大家帮助大家
- 那个函数或方法可以把sbyte转换为string?(注意不是byte、byte[]和sbyte[]而是sbyte)
- C# Winform 使用ExecuteNonQuery只能将数据添加到缓存,不能更新数据库?
- 最近打算上一台服务器,园子里有要合租的吗
InvokeDelegate 是void ControlMethod(object data)样子的委托void ControlMethod(object data)
{
if(Control.RequestInvoke)
{
InvokeDelegate id=new InvokeDelegate(ControlMethod);
Control.Invoke(id,data);
}
else
{
//do what you do
}
}
public delegate void ListBoxDelegate(string strTishi);
private void ListBoxTishi(string strTishiXinxi)
{
if (this.lsbXinxiTishi.InvokeRequired)
{
ListBoxDelegate LBDelegate = new ListBoxDelegate(ListBoxTishi);
this.lsbXinxiTishi.Invoke(LBDelegate, new object[] { strTishiXinxi });
}
else
{
this.lsbXinxiTishi.Items.Add(strTishiXinxi);
this.lsbXinxiTishi.SelectedIndex = this.lsbXinxiTishi.Items.Count - 1;
this.Refresh();
} }
调用时在线程方法调用就行了
例如
strXinxi = DateTime.Now.ToString() + " 第" + i.ToString() + "条信息发送成功";
ListBoxTishi(strXinxi);
strXinxi = String.Empty;