I am learning vb.net from tutorial sites, book and having trouble to delete row from datagrid view. can someone help me how to delete a selected row in datagrid on click of a button .Thank you
the error i get : 'user' is not declared
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim con As SqlCeConnection = New SqlCeConnection("DataSource=C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\samples\Northwind.sdf")
Dim CmdStr As String
Dim dr As DataRow
Dim cmd As SqlCeCommand = New SqlCeCommand(CmdStr, con)
'Dim cmd As
cmd.ExecuteNonQuery()
con.Close()
MsgBox("Done")
dr = users.rows.item(users.currentrow.index)
dr.Delete()
dtusers.acceptchanges()
CmdStr = "Delete* from [users] where ID = " + DataGridView1.CurrentRow.Cells(0).Value + ""
End Sub