Can't remove the last row from datagridview
-
Hi All, Im very new in this and im trying to use a datagridview to show some data from sql server. The user can select multiple rows in the datagridview and ofter pressing the 'del key' and clicking on the 'Save'button, the selected rows will be removed. The problem is that the last row always remains and can't be remove. Here some code of how im trying to update the datatable : myconn = new SqlConnection(ConnectionString); SqlCommandBuilder cb_imp = new SqlCommandBuilder(myda); myconn.Open(); myda.Update(mydt); Can anyone tell me how to fix this? Thanx.
-
Hi All, Im very new in this and im trying to use a datagridview to show some data from sql server. The user can select multiple rows in the datagridview and ofter pressing the 'del key' and clicking on the 'Save'button, the selected rows will be removed. The problem is that the last row always remains and can't be remove. Here some code of how im trying to update the datatable : myconn = new SqlConnection(ConnectionString); SqlCommandBuilder cb_imp = new SqlCommandBuilder(myda); myconn.Open(); myda.Update(mydt); Can anyone tell me how to fix this? Thanx.
Have you selected the property "AllowUserToAddRow" of the datagridview to false?
-
Have you selected the property "AllowUserToAddRow" of the datagridview to false?
yes i did