I have a dialog that is used to select which forms to show. Originally it was just being selected from a combo box, but now we need to select multiple, so we changed it to a list box.
Here is the method that we used for the combo box:
if (view.ShowDialog() == DialogResult.OK)
{
if (view.FormType == "Form1")
return new Form1_Controller();
else if (view.FormType == "Form2")
return new Form2_Controller();
else if (view.FormType == "Form3")
return new Form3_Controller();
else return null;
}
else
{
return null;
}
How can we encapsulate this in a loop that will return a controller for each selection?
For example, I have tried something like
foreach (ListBoxItem listItem in view.ListBox1)
{
//do if (view.FormType == "Form1")
}
But I don't know the right syntax to use.