Datagridview编辑,更新,取消,在Windows窗体中插入 [英] Datagridview Edit, Update, Cancel, Insert in Windows Forms

查看:53
本文介绍了Datagridview编辑,更新,取消,在Windows窗体中插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Windows窗体中获取Gridview样式编辑,更新,取消,插入Datagridview?我希望windows窗体中的datagridview中的每一行都有Edit,Update,Cancel,Insert,这样就可以在datagridview中编辑数据了。任何帮助将不胜感激。

解决方案

你必须向DataGridView添加新的列。

然后在单元格点击事件中,你需要检查什么是ColumnIndex。如果它与已添加按钮的列匹配,那么您将运行逻辑以编辑/更新/删除行。



请参阅此处的一个示例 - C#教程:在DataGridView中添加,删除和编辑行 [ ^ ]

Is it possible to get Gridview style Edit, Update, Cancel , Insert for Datagridview in Windows Form? I want every row in datagridview in windows form to have Edit, Update, Cancel, Insert, so that data can be edited in datagridview in place. Any help will be appreciated.

解决方案

You have to add new Columns to the DataGridView.
Then inside cell click event, you need to check what is the ColumnIndex. If it matches with the Column, where you have added the Button, then you will run a logic to Edit/Update/Delete the Row.

See one example here - C# tutorial: add, delete, and edit rows in DataGridView[^]


这篇关于Datagridview编辑,更新,取消,在Windows窗体中插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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