我在尝试关闭子窗口窗体后刷新父窗口时遇到问题。下面是我的代码:从子窗口刷新父窗口
private void btnSave_Click(object sender, EventArgs e)
{
BusinessClient bc = new BusinessClient();
bc.CompanyName = txtCompanyName.Text;
bc.PointOfContact = txtPointOfContact.Text;
bc.Address1 = txtAddressOne.Text;
bc.Address2 = txtAddressTwo.Text;
bc.City = txtCity.Text;
bc.State = cbxState.Text;
bc.Zip = txtZip.Text;
bc.Phone = txtPhone.Text;
bc.Email = txtEmail.Text;
BusinessClientMgr bcMgr = new BusinessClientMgr();
bcMgr.StoreNewBusinessClient(bc);
AfterTheSave();
AssignmentForm assignForm = new AssignmentForm();
assignForm.Refresh();
this.Close();
}
我想在这里做的是保存数据并关闭子窗口的形式,并有父窗口的形式通过检索新的数据显示刷新。我在这里错过了什么吗?虽然我明白,子窗口窗体不应该控制父母。想想看,小孩正在要求家长更新信息。
您是否尝试过搜索解决方案?这个问题已经答复了上千次。 –
'assignForm.Refresh()'与表单数据无关,只是重绘表单图形。 –
@BastianThiede我已经搜索了解决方案,但都没有被发现,因为它们都与ASP.NET相关,我没有找到。 – Marc