Getting data from selected datagridview row and which event?

后端 未结 5 1358
眼角桃花
眼角桃花 2020-12-08 06:53

I have a DataGridView (Selectionmode: FullRowSelect) on a windows form along with some textboxes, so what i want to do is that whenever a user selects a row(click or double_

5条回答
  •  执念已碎
    2020-12-08 07:19

    First take a label. set its visibility to false, then on the DataGridView_CellClick event write this

    private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
    {
        label.Text=dataGridView1.Rows[e.RowIndex].Cells["Your Coloumn name"].Value.ToString();
        // then perform your select statement according to that label.
    }
    //try it it might work for you
    

提交回复
热议问题