Dialog Box

  • Thread starter Thread starter Jim Heavey
  • Start date Start date
J

Jim Heavey

Hello
If I have created a form which will be used as a dialog box, how do I get
the results passed pack from the dialog box?

I tried this

DialogResult rslt = frm.ShowDialog();

I do not get any compile error, but when I try to use the "rslt" I thought

When I go to check the value, I use statements like:
if (rslt == DialogResult.Cancel)
( return; }

and it does not like these. How do I test the value returned?

One final question...

When I call the constructor for the new form (dialog box), I call it with
my own constructor. I believe I am suppose to call the Original
constructor that has the "Initialize" method in it. How do I call the
original constructor? I think there is a special command for this, I tried
"this.MyConstructor()" but it does not like that and it does not like
"MyConstructor()". So what do I call?

Thanks in advance for your assistance!!!!!!!!!!
 
Jim:

This is in VB, but you can call the whole thing like this...
Select Case MessageBox.Show(sMsg, "Confirm Save As")

Case DialogResult.OK

Case DialogResult.YesNo

Case Else

End Select

In this example, the messagebox sets what the Cancel and Ok buttons are.
However, with your own forms, make sure you set the AcceptButton and
CancelButton or, if you don't, make sure that whatever closes the form
Returns the dialog result you want it to.

What does your constructor look like?
 
Back
Top