数据网格视图聚焦... [英] Data grid View Focusing...

查看:73
本文介绍了数据网格视图聚焦...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在datagridview中选择一行时遇到问题.我希望用户按下数据gridview的数据行标题,然后它必须在文本框中显示特定的字符串

I have a problem with selecting a row in a datagridview. I want the user to press on the data rowheader of the data gridview then it must show in textbox particular strings

推荐答案

如果要显示datagridview的内容,单击该行的任何单元格.然后在datagridview的CellContentClick()事件中编写此代码


If you want to show the contents of the datagridview by clicking on any cell of the row. then Write this code in the CellContentClick() event of the datagridview


textbox1.text = datagridview1.Rows(e.RowIndex).Cells(0).Value
textbox2.text = datagridview1.Rows(e.RowIndex).Cells(1).Value
(etc)



如果要通过单击行标题来显示datagridview的内容,请在datagridview的RowHeaderMouseClick事件中编写此代码




If you want to show the contents of the datagridview by clicking the header of the row then write this code in the RowHeaderMouseClick event of the datagridview


textbox1.text = datagridview1.Rows(e.RowIndex).Cells(0).Value
textbox2.text = datagridview1.Rows(e.RowIndex).Cells(1).Value
(etc)



注意:textbox1和textbox2仅作为示例.在此处使用您的一个字段获取datagridview的内容.



Note: textbox1 and textbox2 are only for example. Use your one fields here to get the datagridview contents.


这篇关于数据网格视图聚焦...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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