Deleting a record from the datagridview

前端 未结 2 1582
無奈伤痛
無奈伤痛 2021-01-16 21:37

In VB2012, I have a created a student management software with SQL2012 as the back-end. The below code is used for deleting a selected record from the datagridview when DELE

2条回答
  •  悲&欢浪女
    2021-01-16 22:31

    Selected row is not necessary current, from the perspective of binding source. You need to be using DataGridView.SelectedRows. Each is a DataGridViewRow, and you should be able to retrieve DataGridViewRow.DataBoundItem, cast it to DataRow, and use Delete on that.

提交回复
热议问题