如何在Windows窗体中为DataGridView创建“编辑”按钮 [英] How to make Edit button for DataGridView in windows forms

查看:88
本文介绍了如何在Windows窗体中为DataGridView创建“编辑”按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为所有 DataGridView 记录制作编辑按钮。





我创建了一个 DataGridView 并在Windows窗体中显示了我所有的 DataTable 内容

我在Page Load事件中设置了只读。



所以,我需要创建一个编辑按钮然后选择记录应该是要编辑,然后编辑它应该设置为只读。



怎么做?

解决方案

< blockquote>编辑你的GridView然后在该gridview里面添加一个按钮然后我们得到Edit按钮点击该按钮的Selected索引chaanged事件中的行项目....获取每个项目Gridview1.slectedRows.Cell [0] .text,Cells [ 1] .text ..... etc


How to make edit button for all DataGridView records.

[Edit]
I have created a DataGridView and displayed all my DataTable contents in windows form
I have set read only in the Page Load event.

So, I need to create an edit button then selected record should be made to be edited then after editing it should be set to read only.

How to do this?

解决方案

Edit your GridView Then add a button inside to that gridview then we get Edit button click row items in Selected index chaanged event of that button ....for get each item Gridview1.slectedRows.Cell[0].text,Cells[1].text .....etc


这篇关于如何在Windows窗体中为DataGridView创建“编辑”按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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