Good Day,
Im using RowsRemoved class to remove records in datagridview But it deleted the following databind record instead of intended record. How to resolve this problem?
ie. username was "ABC" on textbox1.text.
When i deleted "ABC" from datagridview, then textbox1.text captured following value "AAA" but AAA was deleted instead of "ABC"
Seeking for advise and suggestion.
Thank you and Regards.
Im using RowsRemoved class to remove records in datagridview But it deleted the following databind record instead of intended record. How to resolve this problem?
ie. username was "ABC" on textbox1.text.
When i deleted "ABC" from datagridview, then textbox1.text captured following value "AAA" but AAA was deleted instead of "ABC"
Seeking for advise and suggestion.
Thank you and Regards.
Code:
Private Sub DataGridView2_RowsRemoved(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowsRemovedEventArgs) Handles DataGridView2.RowsRemoved
'TextBox1 data binded to username
'TextBox1.DataBindings.Add("Text", dv, "username")
objCommand.Connection = cn
objCommand.CommandText = "delete from usertable where username='" & TextBox1.Text & "'"
objCommand.ExecuteNonQuery()
MsgBox("deleted")
End Sub