I have a DataGridView that receives its information from a BindingList. When the program runs, the DGV should appear completely blank with no row data whatsoever. However, it instead creates a row with a couple values in some of the cells. In my Form startup, I've included
ExpenseList = new BindingList<ExpenseReportBackBone>();
dataGridViewPurchaseData.DataSource = ExpenseList;
ExpenseList.Clear();
dataGridViewPurchaseData.Rows.Clear();
to try and empty it out, but it still appears as the screenshot shows. Why is this not opening to a blank DGV?
作为DataGridView
的默认设置, AllowUsersToAddRows
设置为true,您将看到的是新添加的行。
i dont know why its not empty when you run the program ,but try to clear it first null the data source:
this.dataGridView.DataSource = null;
and after clear rows
this.dataGridView.Rows.Clear();
if you are using BindingList
DataGrid.DataSource = null;
DataGrid.DataBind();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.