I have binded a datagridview to a datatable. But the gridview displays an extra empty row at the bottom ? How should I hide it ? Thanks in Advance
Asked
Active
Viewed 2.0k times
2 Answers
51
The extra row is to manually add a line to your datagridview. If you don't need it you can disable it by disallowing the user to add rows:
this.dataGridView.AllowUserToAddRows = false;

Jla
- 11,304
- 14
- 61
- 84
-
I spent an hour hunting through XML-parsing code, thinking something was being imported incorrectly...thanks! :) – Alex Sep 03 '13 at 16:38
-
1I found this looking for an answer to just a DataGrid. It's property equivalent is `CanUserAddRows`. – ian.aldrighetti Apr 29 '15 at 18:21
1
You can try this:
CurrencyManager cm = myGrid.BindingContext[myGrid.DataSource, myGrid.DataMember]
as CurrencyManager;
DataView dv = cm.List as DataView;
dv.AllowNew = false;

Edwin de Koning
- 14,209
- 7
- 56
- 74