当我以其他形式进行GridView数据更新然后数据更新但是当关闭此表单时,gridview数据刷新不会在C#win-forms应用程序中自动响应 我的代码在这里:
private void button1_Click(object sender, EventArgs e)
{
aCatagory=new tbl_Catagory();
aContext = new RM_Inventory_DataContext();
var product = (from p in aContext.tbl_Catagories
where p.CatagoriesID == Convert.ToDecimal(textBox1.Text)
select p).Single();
product.CatagoriesName = textBox2.Text;
aContext.SubmitChanges();
this.Close();
AddCatagories addCatagories=new AddCatagories();
addCatagories.GridView();
}
public void GridView()
{
gridControl1.DataSource = new RM_PM_Inverntory_Management_System.RM_Inventory_DataContext().tbl_Catagories;
}
答案 0 :(得分:0)
分配数据源后,您没有绑定gridview。
public void GridView()
{
gridControl1.DataSource = What ever Data Source You have
gridControl1.DataBind();
}