| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 8738 人关注过本帖
标题:dataGridView 选中单元格如何获取行号
取消只看楼主 加入收藏
mlrh3838
Rank: 1
等 级:新手上路
威 望:1
帖 子:199
专家分:0
注 册:2007-6-14
收藏
 问题点数:0 回复次数:1 
dataGridView 选中单元格如何获取行号
dataGridView 控件 与 dataGrid 单击单元格取得该行行号 不一样吗?

哪位高手能详细的说下吗?

最好写一段代码 单击 dataGridView1 控件单元格,获得行号,
搜索更多相关主题的帖子: dataGridView 行号 单元 获取 
2007-07-03 10:57
mlrh3838
Rank: 1
等 级:新手上路
威 望:1
帖 子:199
专家分:0
注 册:2007-6-14
收藏
得分:0 

谢谢诸位,下面是小弟对这两个控件的一点总结,不知是否正确

DataGrid:
int row = this.dataGrid1.CurrentCell.RowNumber; //单元格获取行号

DataGridView:
int row = this.dataGridView1.CurrentCell.RowIndex; //单元格获取行号
int row = this.dataGridView1.CurrentRow.Index;

还有一事请较诸位:

在 DataGrid 控件中:
int row = this.dataGrid1.CurrentCell.RowNumber;
this.dataGrid1.CurrentCell = new DataGridCell(row+1, 0);

在DataGridView中应该该怎样写,蓝色部分DataGridView控件是不能用的


2007-07-03 12:23
快速回复:dataGridView 选中单元格如何获取行号
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011179 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved