datagridview / 绑定列表 / 绑定源绑定永远持续
我正在尝试类似下面的代码。区别在于 BindingSource
和 DataGridView
是由 Windows 窗体表单的设计者创建的。
发生的情况是数据绑定似乎挂起。该操作是异步的,因此执行会继续,直到出现错误,因为 datagridview 上没有列
我认为这是问题所在,因为我在 dataGridView_DataBindingComplete
事件中放置了断点,并且它永远不会被命中,或者这需要很长时间。
数据源是包含单个项目的列表,因此负载不应该成为问题。我还尝试更改 DataSource 分配的顺序,但没有成功。
public void OpenForm()
{
L = new BindingList<conhecimento>();
L.Add(new conhecimento());
BS.DataSource=L;
DG.DataSource = BS;
myForm.Show()
}
I'm trying something like the code below. The difference being the BindingSource
and DataGridView
are created by the designer of my Windows Forms form.
What happens is the data binding seems to hang. The operation is asynchronous, so the execution continues until you get an error because there are no columns on the datagridview
I think that is the problem because I placed breakpoint inside the dataGridView_DataBindingComplete
event and it is never hit, or it takes a long time.
The data source is a list with a single item, so load should not be an issue. I also tried changing the order of the DataSource
assignments but no luck.
public void OpenForm()
{
L = new BindingList<conhecimento>();
L.Add(new conhecimento());
BS.DataSource=L;
DG.DataSource = BS;
myForm.Show()
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过跳过 BindingSource 并执行以下操作:
Have you tried skipping the BindingSource and just doing: