Manually add rows. Problem with AllowUserToAddRows

M

Mr. X.

Hello.
I want that only manually I can add rows to DataGridView.
(But only in code).
What I do, is :
AllowUserToAddRows = false with most of the times.
When I click to add rows, I do :
Dim dr as datarow
Dim dc As DataGridViewCell

AllowUserToAddRows
dr = MyDataTable.newRow()
dc = Rows(Rows.Count - 1).Cells(0)
CurrentCell = dc
CurrentRow.Selected = True
....
And at last I do :
AllowUserToAddRows = False
(If I not, I see that there is new empty row. I don't want to see an empty
row, without doing new).
But I get an exception : AllowUserToAddRows = False.

1. I don't want automatically that dataGridView should add rows.
2. I want manually to add rows to dataGridView, but if AllowUserToAddRows
=false, the object dataGridView doesn't let me doing so.

Thanks :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top