2010年6月10日星期四

How to select a row in DataGridView

the C++.Net solution is :
this->dataGridView1->ClearSelection();
this->dataGridView1->SelectionMode = DataGridViewSelectionMode::FullRowSelect;
this->dataGridView1->Rows[i]->
Selected=true;
this->dataGridView1->
CurrentCell=this->dataGridView1->Rows[i]->Cells["ColumnName"];
这几步的作用分别是:
清除当前选择;设定选择模式为整行选取;设定某行为选定;设定当前网格