datagridview选中多个单元格时触发什么事件呢?我想实现选中多个单元格时,得到第一行与最后一行的行号 datagridview选中多个单元格时触发什么事件呢?我想实现选中多个单元格时,得到第一行与最后一行的行号我要实现,只要用户进行了选中多个单元格的操作,就在文本框中显示出,选择单元格第一行的行号,和最后一行的行号。关键不知道,纸型选中多个单元格时,触发什么事件呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 本帖最后由 bdmh 于 2012-03-29 10:00:32 编辑 private void dataGridView1_SelectionChanged(object sender, EventArgs e) { List<int> lstIndex = new List<int>(); foreach (DataGridViewTextBoxCell cell in dataGridView1.SelectedCells) { if (!lstIndex.Contains(cell.RowIndex)) { lstIndex.Add(cell.RowIndex); } } if (lstIndex.Count > 0) { lstIndex.Sort(); //第一行 int firstRow = lstIndex[0]; //最后行 int lastRow = lstIndex[lstIndex.Count - 1]; } } 键值对 关于datagridview中DataGridViewTextBoxColumn问题 高分解决一个问题 我用vs2005 的安装与部署有什么办法实现更新安装不需要先把之前的卸载掉再安装? 执行存储过程出错. 如何让窗体延迟弹出? 邮件发送 对.net很熟,想转j2ee,需要多长的时间,困难吗?(在广西,精通.net而找不到高薪的工作,无奈!—) C#初学者的问题,在原窗口中弹出一个新窗口,然后关闭原来的窗口 c#使用sqllite数据库将备份数据还原 C# 怎么知道DNS是不是自动获取的? wpf 找不到BounceEase类
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
List<int> lstIndex = new List<int>();
foreach (DataGridViewTextBoxCell cell in dataGridView1.SelectedCells)
{
if (!lstIndex.Contains(cell.RowIndex))
{
lstIndex.Add(cell.RowIndex);
}
}
if (lstIndex.Count > 0)
{
lstIndex.Sort();
//第一行
int firstRow = lstIndex[0];
//最后行
int lastRow = lstIndex[lstIndex.Count - 1];
}
}