具有来自另一个线程的数据的DataBinding Grid [英] DataBinding Grid with data from another thread

查看:99
本文介绍了具有来自另一个线程的数据的DataBinding Grid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据结构(bindingList),它从另一个线程接收数据,而我绑定到了引发跨线程异常的dataGridView.如何调用dataBound的dataGridView?这是一个winForm项目.为了清楚起见,这是我正在谈论的一个示例:

I have a data structure(bindingList)that receives data from a another thread with I''ve bound to a dataGridView which is throwing a cross thread exception. how do I invoke a dataGridView which is dataBound? This is a winForm project. Here''s an example of what I''m talking about for clarity:

DataStore dStore = new DataStore();
dStore.ReceiveData += new ReceiveDataEventHndlr(data);
BindingList<mydataobj> myDataStructure = new BindingList<mydataobj>();
dataGridView.DataSource = myDataStructure;

// here's my cross threading issue
private void data(string s, double d)
{
    myDataStructure.Add(new MyDataObj(s,d));
}

推荐答案

[ ^ ]是我的第一个谷歌点击.

此外,对Code Project的搜索也会产生 [ ^ ].
This[^] was my first google hit.

Also, a search of Code Project yields this[^].


这篇关于具有来自另一个线程的数据的DataBinding Grid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆