所以我有一个主论坛和一些儿童论坛。对于主窗体,我使用带有dataview行过滤器的搜索文本框。虽然问题是在我的子表单中我正在更新数据库记录,然后必须回到主表单并使用新记录更新DataGridView。
但是当我尝试时,即使我硬编码DataView过滤器,datagridview也不会向我显示更新的视图。
public void RefreshDGV()
{
//Method thats being called from child form
SQL_Data.table.Clear();
this.dataGridView1.RowCount = 1;
this.dataGridView1.Rows.Clear();
this.Refresh();
this.dataGridView1.Refresh();
this.DataGridFill();
AptSearchRefill();
}
//Function that needs to set up a new view to show new/updated records
public void AptSearchRefill()
{
try
{
DataView dvrefresh = new DataView(SQL_Data.table);
dvrefresh.RowFilter = string.Format("apt_num LIKE '%{0}%'", apt_search.Text);
//Problem lies here^ Even when apt_search.text is hardcoded, still nothing.
dataGridView1.DataSource = dvrefresh;
}
catch (Exception ex)
{
WriteToLog.Write(ClassName, ex.ToString(), StoreUser.Username.ToString());
}
}