Here comes the trouble. I want to delete all rows from datagridview. This how i add rows:
private void ReadCompleteCallback(object clientHandle, Opc.Da.ItemV
If I remember correctly, I set the DataSource property to null to clear the DataGridView:
datagridview.DataSource = null;
Try this
DataGridView1.DataSource=ds;
ds.Clear();
dataGridView1.DataSource=null;
I'm betting you just need to refresh the datagrid. Try this:
dataGridView1.Rows.Clear();
dataGridView1.Refresh();
If this works... you might want to rethink this part of your application.
try setting RowCount to 0(allowuserstorows should be false), along with calling clear
If your DataGridView
does not have any DataSource
the solution does not come by manipulating it.
You will always have an empty
row if you have the AllowUserToAddRows
property set to true
.
Put AllowUserToAddRows = false
if you don't need permise this.