form flow

  • Thread starter Thread starter Stephen Cao
  • Start date Start date
S

Stephen Cao

I have a for loop (below) in a Pocket PC Mobile OS 5, .NET Compact
Framework 2 SP2 app:

frmMain...
public void process()
{
QuestionList[] object;
Form1 frm1;
Form2 frm2;

for (i = 1; i < 10, i++)
{
switch QuestionList.type //type is 1 or 2
{
case 1:
frm1 = new Form1();
frm1.ShowDialog();
case 2:
frm2 = new Form2();
frm2.ShowDialog();
}

frm1.Dispose();
frm2.Dispose();

}

}

form2...
private void btnNext_Click(object sender, CancelEventArgs e)
{
this.Close();
}

form1
private void btnNext_Click(object sender, CancelEventArgs e)
{
this.Close();
}

My question is this: right now frm1 and frm2 are being closed; is
there a way to not close them but to reuse frm1 and frm2, showing
users frm1 or frm2, have them response to the form, and then passing
control back to for loop.

Thanks,
Stephen
 
Yes, being shown with ShowDialog you can check the DialogResult of the
appropriate Form. You're also aware you're Disposing Forms you're not
creating? Also, if you intend to reuse the Form then you shouldn't Dispose
it - that's the point of a ShowDialog.
 
Back
Top