Manually add rows. Problem with AllowUserToAddRows

  • Thread starter Thread starter Mr. X.
  • Start date Start date
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 :)
 
Back
Top