开发者

DataGridView Remove Ability For User To Add New Row?

开发者 https://www.devze.com 2023-02-03 10:48 出处:网络
At the bottom of a DataGridView, there appears to be an empty row for the user to fill outif he/she wants开发者_JAVA百科 to add another row.Is it possible to remove this feature from the DataGridViews

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

精彩评论

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