的DataGridView /数据表|的RowState不改变 [英] DataGridView / DataTable | rowState doesn't change

查看:451
本文介绍了的DataGridView /数据表|的RowState不改变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用数据绑定到DataGridView的问题。

I'm having a problem with binding data to the DataGridView.

我有一个类MyDataGridView是从DataGridView继承。我的数据网格视图的数据源是保存一个DataTable作为数据源的BindingSource对象

I have a class MyDataGridView that inherit from DataGridView. My data grid view data source is a BindingSource object that holds a DataTable as the data source.

但问题是,当我提出通过(我的)的DataGridView对象的变化 - 在RowState的停留在未经修改而不是修改;即使在数据表中的值改变(这是什么使得我的更新不能正常工作,因为它考虑的RowState为未定义)。 。请注意,直接更改到DataTable正常工作

Problem is, when I make changes via (my) DataGridView object - the rowState stays on 'unmodified' instead of modified; even though the values in the DataTable changed (that's what makes my update not work, since it consider the rowState as undefined). Notice that making changes directly to the DataTable works fine.

感谢您(:

推荐答案

您必须调用包含网格形式的验证方法,该方法,如果你将焦点移到网格中的另一行影响到电网。

you must call the Validate method of the form that contains the grid. This method affect to grid as if you move the focus to another row in the grid.

这篇关于的DataGridView /数据表|的RowState不改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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