我不想要这种效果 不知道什么属性 请告知
问题2:我要判断我在选中时 单元格里面的值 怎么获得 就是怎么获得当前行的第2列的值

解决方案 »

  1.   


    dataGridView1.DataSource=???;
                dataGridView1.ClearSelection();
                dataGridView1.CurrentCell = dataGridView1.Rows[1].Cells[0];
            
    选中第2行.
    dataGridView1.SelectedRows[0].Cells[1].Value 选种行的第2列的值
      

  2.   


    dataGridView1.Rows[“获取单击的行的索引值”].Cells[1].Value 
      

  3.   

    补上获取索引,够详细了吧
    datagridview.CurrentCell.RowIndex;是当前活动的单元格的行的索引
    datagridview.SelectedRows 是选中行的集合
    datagridview.SelectedColumns 是选中列的集合
    datagridview.SelectedCells 是选中单元格的集合
    DataGridView1.CurrentRow.Index 获得包含当前单元格的行的索引DataGridView1.CurrentRow.Cells[1].Value.ToString获取点击行中的列的值,1表示第二列值
      

  4.   

    datagridview 查询出数据后总是第一行第一列被选中我不要这效果 请问什么属性?
      

  5.   

    dataGridView1.DataSource=???; 
                dataGridView1.ClearSelection(); 
                dataGridView1.CurrentCell = dataGridView1.Rows[1].Cells[0]; 这样不能改变第1行选中状态?
      

  6.   

    那就在OnRowEnter事件中让它选中整行
    dataGridView1.Rows[ex.RowIndex].Selected = true;
      

  7.   

    this.dgvBarcodes.Rows[0].Cells[0].Selected = true;
      

  8.   

    ClearSelection(); 不行吗??