开发者

Hide the extra row at the bottom in a DataGridview in a Winform Application

开发者 https://www.devze.com 2023-01-25 11:36 出处:网络
I have binded a datagridview to a datatable. But the gridview display开发者_如何学Cs an extra emptyrow at the bottom ? How should I hide it ? Thanks in AdvanceThe extra row is to manually add a line t

I have binded a datagridview to a datatable. But the gridview display开发者_如何学Cs an extra empty row at the bottom ? How should I hide it ? Thanks in Advance


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;


You can try this:

CurrencyManager cm = myGrid.BindingContext[myGrid.DataSource, myGrid.DataMember] 
                     as CurrencyManager;
DataView dv = cm.List as DataView;
dv.AllowNew = false;
0

精彩评论

暂无评论...
验证码 换一张
取 消