c#多线程委托返回值问题 200
C#多线程操作ui组件的时候怎样调用返回值privatedelegatevoidThreadWork2(inti,stringresult,stringsendtime)...
C#多线程操作ui组件的时候怎样调用返回值
private delegate void ThreadWork2(int i,string result,string sendtime);
private void SendMenu_Click(object sender, EventArgs e)
{
Thread thread = new Thread(new ThreadStart(GetValue));
thread.Start();
}
void GetValue(){
for (int i = 0; i < list.Items.Count; i++)
{
TelListFlagFunction(i,result,sendtime);
Thread.Sleep(500);
}
}
private void TelListFlagFunction(int i, string result, string sendtime)
{
if (this.list.InvokeRequired)
{
ThreadWork2 fc = new ThreadWork2(TelListFlagFunction);
this.Invoke(fc,new object[]{i,result,sendtime});
}
else {
this.list.Items[i].SubItems[1].Text = result;
this.list.Sorting = System.Windows.Forms.SortOrder.None;
this.list.Items[i].SubItems.Add(sendtime);
}
}
Tellistflagfunction怎样根据getvalue里面的变量给GetValue返回个字符串, 展开
private delegate void ThreadWork2(int i,string result,string sendtime);
private void SendMenu_Click(object sender, EventArgs e)
{
Thread thread = new Thread(new ThreadStart(GetValue));
thread.Start();
}
void GetValue(){
for (int i = 0; i < list.Items.Count; i++)
{
TelListFlagFunction(i,result,sendtime);
Thread.Sleep(500);
}
}
private void TelListFlagFunction(int i, string result, string sendtime)
{
if (this.list.InvokeRequired)
{
ThreadWork2 fc = new ThreadWork2(TelListFlagFunction);
this.Invoke(fc,new object[]{i,result,sendtime});
}
else {
this.list.Items[i].SubItems[1].Text = result;
this.list.Sorting = System.Windows.Forms.SortOrder.None;
this.list.Items[i].SubItems.Add(sendtime);
}
}
Tellistflagfunction怎样根据getvalue里面的变量给GetValue返回个字符串, 展开
展开全部
你说的getvalue在哪?C#是大小写敏感的
追问
void GetValue(){
for (int i = 0; i < list.Items.Count; i++)
{
TelListFlagFunction(i,result,sendtime);
Thread.Sleep(500);
}
}
追答
怎样根据getvalue里面的变量给GetValue返回个字符串---为什么你一个小写一个大写
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询