K
katie
Not sure how to explain this problem so here it goes... I have two forms and
I want to copy data from one form to load into another. Now this seems to be
working but the problem is the various controls seem to be populated before
the bindingcontext is finished. Therefore erasing my preload data.
How can I load this data into the new form without it being lost?
private void RegForm_Load(object sender, System.EventArgs e)
{
FillDataSets(); // goes into bindingcontext addnew
if(tFormStateStored != 0)
{
tFormStateStored = 0;
txtBoxCompany.Text = tCompany;
txtBoxAddress.Text = tAddress;
txtBoxCity.Text = tCity;
txtBoxStateProvince.Text = tState;
txtBoxZip.Text = tZip;
txtBoxPhone.Text = tPhone;
txtBoxEmail.Text = tEmail;
}
}
private void saveCreateCopy_Click(object sender, System.EventArgs e)
{
// copy some data...
tFormStateStored = 1;
tCompany = txtBoxCompany.Text;
tAddress = txtBoxAddress.Text;
tCity = txtBoxCity.Text;
tState = txtBoxStateProvince.Text;
tZip = txtBoxZip.Text;
tPhone = txtBoxPhone.Text;
tEmail = txtBoxEmail.Text;
// load a new form
RegForm newMDIChild = new RegForm();
newMDIChild.LoadCompanyID = 0;
// Set the Parent Form of the Child window.
newMDIChild.MdiParent = this.ParentForm;
// Display the new form.
newMDIChild.Show();
}
Kate S.
I want to copy data from one form to load into another. Now this seems to be
working but the problem is the various controls seem to be populated before
the bindingcontext is finished. Therefore erasing my preload data.
How can I load this data into the new form without it being lost?
private void RegForm_Load(object sender, System.EventArgs e)
{
FillDataSets(); // goes into bindingcontext addnew
if(tFormStateStored != 0)
{
tFormStateStored = 0;
txtBoxCompany.Text = tCompany;
txtBoxAddress.Text = tAddress;
txtBoxCity.Text = tCity;
txtBoxStateProvince.Text = tState;
txtBoxZip.Text = tZip;
txtBoxPhone.Text = tPhone;
txtBoxEmail.Text = tEmail;
}
}
private void saveCreateCopy_Click(object sender, System.EventArgs e)
{
// copy some data...
tFormStateStored = 1;
tCompany = txtBoxCompany.Text;
tAddress = txtBoxAddress.Text;
tCity = txtBoxCity.Text;
tState = txtBoxStateProvince.Text;
tZip = txtBoxZip.Text;
tPhone = txtBoxPhone.Text;
tEmail = txtBoxEmail.Text;
// load a new form
RegForm newMDIChild = new RegForm();
newMDIChild.LoadCompanyID = 0;
// Set the Parent Form of the Child window.
newMDIChild.MdiParent = this.ParentForm;
// Display the new form.
newMDIChild.Show();
}
Kate S.