Hey professionals, I use DataGridView that allows me to add new rows in table. But when I want to delete it by clicking on my deleting button with following code:

DataGridView.Rows.RemoveAt(DataGridView.CurrentCell.RowIndex);

...it makes problems, others rows aren't problematic to delete but this is. But not on purpose I want to delete this row for adding new rows of the table, but only to prevent some coincidental clicking on the button.

...this table of DataGridView is filled by Dataset which is filled by xml file.

if you are talking about the default blank row at the bottom of all the rows then you have to turn off the property AllowUserToAddRows.

Since it is not a real row you cannot delete it.

hi
if u want to delete selected row means, the code s
dataGridView1.Rows.RemoveAt(dataGridView1.CurrentRow.Index);

for Add rows
dataGridView1.Rows.Add(10,10);
adding value s depending upon u


if its working fine plz mark as RESOLVED

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.