开启子线程设置GridVIew数据源

<p>老办法:声明委托</p>
<p>public delegate void SetDgValueEventHandler(DataGridView cc, object obj);</p>
<p><textarea cols="50" rows="15" name="code" class="c-sharp"> private void SetDgValue(DataGridView cc, object obj)
        {
            if (cc.InvokeRequired)
            {
                SetDgValueEventHandler dd = new SetDgValueEventHandler(SetDgValue);
                cc.Invoke(dd, new object[] { cc, obj });
            }
            else
            {
                cc.DataSource = obj;
            }
        }</textarea></p>
<p>SetDgValue(dgView, list);</p>

你可能感兴趣的:(GridView)