datagridview的行点击 [英] datagridview row click

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

问题描述

我有一个充满了从数据库数据的一个DataGridView,我需要做到这一点: 当在数据网格上连续点击所有与该行数据的字段将在其他文本框或别的东西。怎么办呢?先谢谢了。

I have a datagridview which is filled with data from db and i need to do this: when click on a row in datagrid all the fields with data from this row will be in other textboxes or something else. How to do so? Thanks in advance.

推荐答案

在你的 CellClick 事件,请INT rowIndex位置= e.RowIndex 。从那里,你可以做的DataGridViewRow行= DataGridView1.Rows [rowIndex位置] 并访问所有细胞(或更好然而,从根本数据表)。

On your CellClick event, do int rowIndex = e.RowIndex. From there you can do DataGridViewRow row = DataGridView1.Rows[rowIndex] and access all the cells in row (or better yet, from your underlying DataTable).

这篇关于datagridview的行点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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