How do I select a complete dataGridView Row when the user clicks a cell of that row?

后端 未结 6 1013
梦毁少年i
梦毁少年i 2020-12-14 14:01

I have a dataGridView and I need that when the user clicks on any cell the whole row that contains this cell is selected too. (it has multiselect disbaled) I t

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-14 14:35

    You can Do this: May be it can help you.

    private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex>0)
            {
                int rowindex = e.RowIndex;
                DataGridViewRow row= this.dataGridView1.Rows[rowindex];
            }
        }
    

提交回复
热议问题