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
精彩评论