从DataGrid编辑DataTable [英] Editing a DataTable from a DataGrid

查看:90
本文介绍了从DataGrid编辑DataTable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我需要帮助 - 再次 -


我有一个DataGrid,其中包含DataTable。当我输入一些测试数据(在代码中)时,它显示得非常好。


现在,我想更改其中一个值Grid,并且具有

DataTable更改。我尝试过使用Validating(和Validated)事件来显示已更改的数据。
它没有改变。我已经尝试将

AcceptChanges和GetChanges添加到我的代码中(对于表格)。


我猜这不应该是难的要做,但我还没弄明白。

谁能告诉我我要离开的东西?


谢谢,

艺术

解决方案

艺术,

现在,我'' d想要更改网格中的一个值,并更改
DataTable。我尝试使用验证(和验证)事件来显示已更改的数据。它没有改变。我已经尝试将
AcceptChanges和GetChanges添加到我的代码中(对于表格)。



这对我来说有点不清楚。您是否正在更改网格中的数据

并希望将其保存在数据表中。或者您是否正在更改

数据表中的数据并且您是否希望它反映在数据网格中?


Cor


Cor,


感谢您再次提出我的问题。


我正在更改表单上的数据,在grid - 用户在运行程序时会将其更改为
。我想将DataTable更改为

反映更改。很明显我是使用DataGrids和DataTables的新手。


再次感谢,


艺术


Cor Ligthert写道:

艺术,

现在,我想改变网格中的一个值,并且
DataTable更改。我尝试使用验证(和验证)事件来显示已更改的数据。它没有改变。我已经尝试将
AcceptChanges和GetChanges添加到我的代码中(对于表格)。


这对我来说有点不清楚。您是否正在更改网格中的数据并希望将其包含在数据表中。或者您是否正在更改
数据表中的数据,是否希望它反映在数据网格中?



"艺术QUOT; < Ar*@discussions.microsoft.com> schrieb

>现在,我想更改网格中的一个值,并且
> DataTable的变化。我尝试使用Validating(和
> Validated)事件来显示已更改的数据。它没有改变。
>我已经尝试将AcceptChanges和GetChanges添加到我的代码中(对于
>表)。
>


这对我来说有点不清楚。您是否正在更改网格中的数据并希望将其存储在数据表中。或者您是否正在更改数据表中的数据并且您是否希望它反映在
数据网格中?


我正在更改表单上的数据 - 在网格中 - 如用户在运行程序时会更改它。我希望然后更改DataTable以反映更改。显然我不习惯使用
DataGrids和DataTables。




如果数据表绑定到数据网格,则数据网格自动

更新数据表。


Armin


Hi,

I need help -- again --

I have a DataGrid with a DataTable as its source. It displays wonderfully
when I put in some test data (withinin the code).

Now, I''d like to change one of the values in the Grid, and have the
DataTable change. I''ve tried using a Validating (and Validated) event to
display the changed data. It doesn''t change. I''ve tried adding
AcceptChanges and GetChanges to my code (for the Table).

I''m guessing this shouldn''t be hard to do, but I haven''t figured it out.
Can anyone tell me what I''m leaving out?

Thanks,

Art

解决方案

Art,

Now, I''d like to change one of the values in the Grid, and have the
DataTable change. I''ve tried using a Validating (and Validated) event to
display the changed data. It doesn''t change. I''ve tried adding
AcceptChanges and GetChanges to my code (for the Table).


This is a little bit unclear for me. Are you changing the data in the grid
and want to have it in the datatable. Or are you changing the data in the
datatable and do you want it reflected in the datagrid?

Cor


Cor,

Thanks for taking my question - again.

I am changing the data on the form, in the grid -- as a user would change it
while running the program. I want the DataTable to then be changed to
reflect the change. Clearly I''m new to using DataGrids and DataTables.

Thanks Again,

Art

"Cor Ligthert" wrote:

Art,

Now, I''d like to change one of the values in the Grid, and have the
DataTable change. I''ve tried using a Validating (and Validated) event to
display the changed data. It doesn''t change. I''ve tried adding
AcceptChanges and GetChanges to my code (for the Table).


This is a little bit unclear for me. Are you changing the data in the grid
and want to have it in the datatable. Or are you changing the data in the
datatable and do you want it reflected in the datagrid?

Cor



"Art" <Ar*@discussions.microsoft.com> schrieb

> Now, I''d like to change one of the values in the Grid, and have
> the DataTable change. I''ve tried using a Validating (and
> Validated) event to display the changed data. It doesn''t change.
> I''ve tried adding AcceptChanges and GetChanges to my code (for the
> Table).
>


This is a little bit unclear for me. Are you changing the data in
the grid and want to have it in the datatable. Or are you changing
the data in the datatable and do you want it reflected in the
datagrid?


I am changing the data on the form, in the grid -- as a user would
change it while running the program. I want the DataTable to then
be changed to reflect the change. Clearly I''m new to using
DataGrids and DataTables.



If the datatable is bound to the datagrid, the datagrid automatically
updates the datatable.

Armin


这篇关于从DataGrid编辑DataTable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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