我写了这段代码:
public partial class Form1 : Form
{
ThreadStart ts = new ThreadStart(fun1);
public Thread t1 = new Thread(ts);
public void fun1()
{
DA da = new DA();
string q = "select * from G5_table order by State";
DataTable dt = da.Select(q);
foreach (DataRow item in dt.Rows)
{
richtxtboxEN.Text = item["Word_en"].ToString();
mode = 1;
richtxtboxEN.TextChanged += new EventHandler(richtxtboxEN_TextChanged);
}
}
private void Form1_Shown(object sender, EventArgs e)
{
t1.Start();
}
}
但我有一个错误字段初始化程序无法引用非静态字段、方法或属性'G5.Form1.fun1()