all groups > vb.net controls > november 2006 >
You're in the

vb.net controls

group:

Dialog


Dialog Steve Arndt
11/17/2006 8:30:35 PM
vb.net controls:
I'm calling a dialog form from a parent form using showdialog. When I
return to the parent form, how can I validate which button was clicked on
the showdialog form.

Thanks

Re: Dialog OpticTygre
11/18/2006 12:19:58 PM
One way of doing it is to define a property (or properties) in your pop-up
form. Once a user clicks the button which closes the form, you can set the
property and check it from your main form:

Dim frmPopup as new form
frmPopup.ShowDialog
If frmPopup.<your property> = <whatever> Then
.....
End If

Another way is to use the Form.DialogResult property. Based on a button
press, you can set a dialog result, and check that from the main form:

Dim frmPopup as new form
If frmPopup.ShowDialog = DialogResult.Ok Then
.....
End If

You can also use the pop-up form's Tag property to store information, and
check that property when the pop-up closes.

Dim frmPopup as new form
frmPopup.ShowDialog
If CType(frmPopup.Tag, <whatever type>) = <whatever object> Then
.....
End If

-Jason

[quoted text, click to view]

AddThis Social Bookmark Button