using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;namespace Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Thread thread = new Thread(UpdateLabel);
private void button1_Click(object sender, EventArgs e)
{
thread.Start();
} private void Form1_Load(object sender, EventArgs e)
{
Control.CheckForIllegalCrossThreadCalls = false;
} public static void UpdateLabel()
{
button1.Text = "fyf"; //报错
} }
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;namespace Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Thread thread = new Thread(UpdateLabel);
private void button1_Click(object sender, EventArgs e)
{
thread.Start();
} private void Form1_Load(object sender, EventArgs e)
{
Control.CheckForIllegalCrossThreadCalls = false;
} public static void UpdateLabel()
{
button1.Text = "fyf"; //报错
} }
}
解决方案 »
- winform 复制
- datagridview列标题特殊符号
- 关于C#编译的问题(弱弱的20分)
- 晕了啊,什么是面向对象???这个类如何写??
- ERROR: Unable to build shortcut named 'Shortcut to Primary output from 。。。。。。
- C# 获取ListView20WndClass中的内容
- 求助 listbox 里面的文字滚动(急……)
- dev gridcontrol 获取 从表的RowHandle 和 数据绑定问题
- 这个正则表达式怎么写?
- c#里的编辑列的激活事件写在哪里?
- C# 访问mysql数据库 conn.Open();出现异常
- 关于c#中connection.cs页面出现未处理NotlmplementedException异常
this.begininvok(()=>{
this.text="aaa";
})
like this?
都 static 了,哪来的 this
ThreadPool.QueueUserWorkItem(new WaitCallback(a => { lb.Text = "123"; }));