且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我如何通过线程访问控制

更新时间:2022-06-20 23:45:14

你可以'除了从创建它们的线程(UI线程)访问控件。

为了做到这一点,你必须使用P / Invoke:

You can''t access controls except from the thread on which they were created (the UI thread).
In order to do it you must use P/Invoke:
Invoke(new MethodInvoker(delegate { DataGridView1.datasource=Connection.runselect(sqlStatment); }));