Im new with datagridview. . . .and i want to delete a certain row or the user will select a item in datagrid but im find it hard to do it. . . .here's my code hope that u can elp me with this. . . .


Code:
If dread.HasRows Then
                Dim cmd1 As New MySqlCommand("DELETE FROM product WHERE p_code = '" & listgrid.SelectedRows(0).Selected & "'", conn1)
                d = cmd1.ExecuteReader
                For Each row As DataGridViewRow In listgrid.SelectedRows
                    listgrid.Rows.Remove(row)
                Next
            End If