求助:总报“执行 CreateHandle() 时无法调用值 Dispose()。”或“未将对象引用设置到对象的实例。”
namespace ShowDataGridView{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Control.CheckForIllegalCrossThreadCalls = false;
}
int time=0;
private void ShowDataGridView()
{
using (SqlConnection conn = new SqlConnection(@"server=.\SQLEXPRESS;database=DataSqlExpress;uid=datawriter;pwd=123456"))
{
SqlDataAdapter da = new SqlDataAdapter("select * from Temp_TABLE", conn);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView.DataSource = ds.Tables[0];
}
}
private void Form1_Load(object sender, EventArgs e)
{
this.timer1.Interval=1000;
this.timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
time++;
if (time >= 10)
{
Thread td = new Thread(new ThreadStart(ShowDataGridView));
td.Start();
time = 0;
}
}
}
}
如题,求助!!