Copy DataGridView values to TextBox

后端 未结 3 2153
旧时难觅i
旧时难觅i 2020-11-22 13:19

I have tried to get an answer to this but so far no help has been able to do what I want it to.

I have this piece of code, which is meant to look at the selected row

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 14:05

    I use a slightly different approach when trying to get data from a datagridview.

    Try doing personIDTextBox.Text = DataGridView01.SelectedCells[0].Value.ToString();

    but instead of the event being on selection change, switch to CellClick and change the property of the the datagridview row selection property to full row select. after that you can change the SelectedCell[0] number to match whichever cell you want

提交回复
热议问题