Hi
I have code to open a form modally:
MM.Forms.frmAdd ProductWizard fAddProdWiz = new
MM.Forms.frmAdd ProductWizard() ;
fAddProdWiz.txt Name.Text =
dgvImportReview .Rows[e.RowIndex].Cells["Name"].Value.ToString ();
int mfgrid =
System.Convert. ToInt32(dgvImpo rtReview.Rows[e.RowIndex].Cells["ManID"].Value);
fAddProdWiz.cmb Mfgr.SelectedVa lue = mfgrid;
fAddProdWiz.Pop ulateOtherDropD owns(mfgrid);
fAddProdWiz.cmb ProdLine.Select edValue =
System.Convert. ToInt32(dgvImpo rtReview.Rows[e.RowIndex].Cells["LineID"].Value);
//fAddProdWiz.txt Name.Text =
dgvImportReview .Rows[e.RowIndex].Cells["Name"].Value.ToString ();
if (fAddProdWiz.Sh owDialog() == DialogResult.OK )
{
}
fAddProdWiz.Dis pose();
in the form I have cmbMfgr_Selecte dIndexChanged event for a combo box. When
it is loading the page I don't want it to change the values in the other
drop downs, once I have finished loading the form I do.
private void cmbMfgr_Selecte dIndexChanged(o bject sender, EventArgs e)
{
if (pageIsLoading)
return;
PopulateOtherDr opDowns(System. Convert.ToInt32 (this.cmbMfgr.S electedValue));
}
It works great the first time around. Second and subsequent times although I
set the pageIsLoading bool to true, by the time it gets to the above method,
it is false. I don't understand. I have closed the form and it has triggered
the Dispose() code.
So why even though at the beginning of the form pageIsLoading is true is it
changing to false. If I stop the program and start it again everything is
fine. It seems to me that it is retaining something in memory, but I don't
know what. I have used this sort of technique multiple times.
I am using VS 2005, .NET 2.0, Win XP Pro SP2.
Thanks
Tim
I have code to open a form modally:
MM.Forms.frmAdd ProductWizard fAddProdWiz = new
MM.Forms.frmAdd ProductWizard() ;
fAddProdWiz.txt Name.Text =
dgvImportReview .Rows[e.RowIndex].Cells["Name"].Value.ToString ();
int mfgrid =
System.Convert. ToInt32(dgvImpo rtReview.Rows[e.RowIndex].Cells["ManID"].Value);
fAddProdWiz.cmb Mfgr.SelectedVa lue = mfgrid;
fAddProdWiz.Pop ulateOtherDropD owns(mfgrid);
fAddProdWiz.cmb ProdLine.Select edValue =
System.Convert. ToInt32(dgvImpo rtReview.Rows[e.RowIndex].Cells["LineID"].Value);
//fAddProdWiz.txt Name.Text =
dgvImportReview .Rows[e.RowIndex].Cells["Name"].Value.ToString ();
if (fAddProdWiz.Sh owDialog() == DialogResult.OK )
{
}
fAddProdWiz.Dis pose();
in the form I have cmbMfgr_Selecte dIndexChanged event for a combo box. When
it is loading the page I don't want it to change the values in the other
drop downs, once I have finished loading the form I do.
private void cmbMfgr_Selecte dIndexChanged(o bject sender, EventArgs e)
{
if (pageIsLoading)
return;
PopulateOtherDr opDowns(System. Convert.ToInt32 (this.cmbMfgr.S electedValue));
}
It works great the first time around. Second and subsequent times although I
set the pageIsLoading bool to true, by the time it gets to the above method,
it is false. I don't understand. I have closed the form and it has triggered
the Dispose() code.
So why even though at the beginning of the form pageIsLoading is true is it
changing to false. If I stop the program and start it again everything is
fine. It seems to me that it is retaining something in memory, but I don't
know what. I have used this sort of technique multiple times.
I am using VS 2005, .NET 2.0, Win XP Pro SP2.
Thanks
Tim