注册 登录
编程论坛 SQL Server论坛

求助:总报“执行 CreateHandle() 时无法调用值 Dispose()。”或“未将对象引用设置到对象的实例。”

sxfplf 发布于 2013-09-04 12:25, 512 次点击
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;
            }
        }
    }
}


如题,求助!!
1 回复
#2
3037709572013-09-05 14:15
根据你的错误提示信息: CreateHandle() 时无法调用值 Dispose()。这两个函数你没有贴出来。我怎么帮助你?
1