麻烦高手来看看,谢谢,关于DataGridView的 怎么扑捉选中了哪些单元格,用什么事件,麻烦高手指点指点,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e){ string value = dataGridView1.CurrentCell.Value.ToString();} 不是每个DataGridView有相关的属性吗? 在那里找找 这些要自己实践 说出来就没意义! private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e) { } this.dataGridView.SelectedRows是所有选中行的然后进一步得到所有单元格,可以:this.dataGridView.SelectedRows[0].Cells[0];this.dataGridView.SelectedRows[0].Cells[1];this.dataGridView.SelectedRows[0].Cells[2];this.dataGridView.SelectedRows[0].Cells[3];。上面是选中的第一行的一些单元格下面是选中的第二行的一些单元格this.dataGridView.SelectedRows[1].Cells[0];this.dataGridView.SelectedRows[1].Cells[1];this.dataGridView.SelectedRows[1].Cells[2];this.dataGridView.SelectedRows[1].Cells[3];。。然后,还有其他行 CellEnter这个事件是可以得到索引,但是当为0列的时候怎么办呢,0列那一行和0列的单元格怎么区别索引呢?索引都是0,N. 0列单元格只可能是:(N,0) N是指当前行索引,与具体的数据行数相关0行单元格只可能是:(0,N) N是指当前列索引,与具体的列数相关 dataGridView1.CurrentCell都在它的属性里。 dataGridView1.CurrentCell.ColumnIndex; dataGridView1.CurrentCell.RowIndex; 一样的,选择的是0列1行的第一个格子,那么索引就是colindex=0和=rowindex=1;如果我选择的是第一1行,索引也是colindex=0和=rowindex=1,这个怎么区分呢???怎么知道是选择的单元格还是选择的行 VC6.0 DLL 想在C#里用, stdcall type 在C#里怎么调用? Beyondbit.Framework是什么框架? 遇到了一个难题 如何在web中持久保存数据,session,cookies,数据库还是其他? pocket pc问题 ContextMenu click 事件无效??? 如何用A数据库中生成的DataSet去更新B数据库(在线等) 【RichTextBox】如何修改部分文字? VS2008 如何调用.net 4.0的dll? 我该怎样才能知道MMControl放完一个文件啊。 VS05 treeview中点击传递值问题? 请问这个的结果是多少,为什么????
{
string value = dataGridView1.CurrentCell.Value.ToString();
}
{
}
this.dataGridView.SelectedRows[0].Cells[0];
this.dataGridView.SelectedRows[0].Cells[1];
this.dataGridView.SelectedRows[0].Cells[2];
this.dataGridView.SelectedRows[0].Cells[3];
。
上面是选中的第一行的一些单元格
下面是选中的第二行的一些单元格
this.dataGridView.SelectedRows[1].Cells[0];
this.dataGridView.SelectedRows[1].Cells[1];
this.dataGridView.SelectedRows[1].Cells[2];
this.dataGridView.SelectedRows[1].Cells[3];
。
。然后,还有其他行
0行单元格只可能是:(0,N) N是指当前列索引,与具体的列数相关
dataGridView1.CurrentCell.RowIndex;