当我点击datagridview中的特定记录时,记录值显示在文本框中 [英] when i click the particular record in datagridview that record values show in textbox

查看:189
本文介绍了当我点击datagridview中的特定记录时,记录值显示在文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

教师代码文本框1

教师姓名textbox2

分配小时文本框3



然后我有一个保存按钮。



当我运行时,输入相应文本框记录中的所有值都插入到数据库中。



工作正常。



然后我有一个搜索按钮。



当我点击搜索按钮插入的记录显示在datagridview中。



也工作正常。



我怀疑如下所示;



当我点击选择记录值应该在相应文本框中显示的特定记录时。



,我怎么能用csharp。





当我点击搜索按钮时,所有保存的记录显示在Datagridview中跟随;





Gs G sekar 10

VRV VR Venkatesh 15.



在datagridview中,当我选择记录数据'想要在相应的texbox中显示的Gs记录时。



我怎样才能使用csharp。

Faculty Code textbox1
Faculty Name textbox2
Allocated Hrs textbox3

then i have one save button.

when i run, and enter all the values in the respective textbox records are inserted in the database.

that is working fine.

then i have one search button.

when i click the search button inserted records shows in the datagridview.

that is also working fine.

My doubt is as follows;

when i click select the particular record that record values should shows in the respective textbox.

for that how can i do using csharp.


when i click the search button all saved record shows in the Datagridview as follows;


Gs G sekar 10
VRV VR Venkatesh 15.

in the datagridview when i select the Gs record that record data''s want to show in the respective texbox.

how can i do using csharp.

推荐答案

在datagridview的单元格点击事件中,

In datagridview''s Cell click event,
textbox1.text = datagridview1.rows[e.RowIndex].cells[0].value;
textbox2.text = datagridview1.rows[e.RowIndex].cells[1].value;
textbox3.text = datagridview1.rows[e.RowIndex].cells[2].value;



快乐编码!

:)


Happy Coding!
:)


这篇关于当我点击datagridview中的特定记录时,记录值显示在文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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