'check for the selected item in list If Form7.DataGridView1.Rows.Count > 0 Then If Form7.DataGridView1.SelectedRows.Count > 0 Then Dim intStdID As Integer = Form7.DataGridView1.SelectedRows(0).Cells("pID").Value 'open connection If Not cnn.State = ConnectionState.Open Then cnn.Open() End If 'delete data Dim cmd As New OleDb.OleDbCommand cmd.Connection = cnn cmd.CommandText = "DELETE FROM NTIdb WHERE pID=" & intStdID cmd.ExecuteNonQuery() 'refresh data Me.RefreshData() 'close connection cnn.Close() End If End If
Form7.DataGridView1.SelectedRows(0).Cells("pID").Value
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)