From: Mr. X. on 3 May 2010 00:35
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
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.