在DataGridView中获取行号 [英] Getting row number in a DataGridView

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

问题描述

如何获取行号DataGridView单元格?具体来说,如果用户选择了单个单元格,那么您如何获得该行号呢?它需要根据用户选择的内容来访问特定的单元格。

How do you get row number DataGridView cell? Specifically, if a user has selected a single cell, how can you get that row number? It needs to access a particular cell based on what the user has selected.

我知道RemoveAt方法可以用于在Focus处删除,但是您无法获取

I know that the RemoveAt method can be used to remove at the Focus, but you cannot get the row number at focus apparently?

感谢您的帮助!

推荐答案

您可以简单地使用 RowIndex 当前单元格

var row = dataGridView1.CurrentCell.RowIndex;

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

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