ChewDoggie
Programmer
Hello All,
I have a generic collection in a child Windows form and I need to pass the collection to the parent form. Does anyone know how to do this seemingly simple thing ?
I have a FormClosingEventHandler in the parent form that has the following code:
Anyhow, after I execute this code, the two collections (objSelectedCompany.CompanyDepartments (Parent Form) AND
EditCompanyForm.CompDepts (Child Form)) should match and they don't.
The only thing I can think of is that each CompanyDepartment has a collection of "CompanyShifts" and that collection is popuated with the number of shifts. Does that collection have to be removed prior to doing something with the Departments ?
If anyone sees something I'm missing, please let me know.
Chew
10% of your life is what happens to you. 90% of your life is how you deal with it.
I have a generic collection in a child Windows form and I need to pass the collection to the parent form. Does anyone know how to do this seemingly simple thing ?
I have a FormClosingEventHandler in the parent form that has the following code:
Code:
private void MyFormClosingHandler(object sender, FormClosingEventArgs e)
{
Form F = (Form)sender;
if (F.Name == "frmEditCompany")
{
// objSelectedCompany is an object in the parent form and it has a collection of CompanyDepartments. I clear them all out because I want to rebuild the collection from the edited collection in the child form
objSelectedCompany.CompanyDepartments.Clear();
// EditCompanyForm is the child form and CompDepts is the generic collection in that form. I want to pass THIS collection to the collection in the parent object.
foreach (clsDepartment D in EditCompanyForm.CompDepts)
{
objSelectedCompany.CompanyDepartments.Add(D);
}
}
}
Anyhow, after I execute this code, the two collections (objSelectedCompany.CompanyDepartments (Parent Form) AND
EditCompanyForm.CompDepts (Child Form)) should match and they don't.
The only thing I can think of is that each CompanyDepartment has a collection of "CompanyShifts" and that collection is popuated with the number of shifts. Does that collection have to be removed prior to doing something with the Departments ?
If anyone sees something I'm missing, please let me know.
Chew
10% of your life is what happens to you. 90% of your life is how you deal with it.