开发者

DataGridView Remove Ability For User To Add New Row?

At the bottom of a DataGridView, there appears to be an empty row for the user to fill out if he/she wants开发者_JAVA百科 to add another row. Is it possible to remove this feature from the DataGridViews I create?


Set the AllowUserToAddRows to false

dataGridView1.AllowUserToAddRows = false;


Set DataGridView.AllowUserToAddRows=False


You can use DataGridView.AllowUserToAddRows property or if you use DataView you can do fallowing:

DataView dataView = new DataView(dataTable);
dataView.AllowNew = false;
dataGridView1.DataSource=dataView;

There are also other properties you can control in DataView: AllowEdit, AllowDelete

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜