wyrd
Senior Contributor
How can I make a form return a value when it closes? That way I can use it much like a MessageBox and how it returns values.
Thanks in advance.
Thanks in advance.
Public Class fclsEmployeeSignIn
Inherits System.Windows.Forms.Form
Public strdatasource As String
Public networkinstallation As Boolean
Dim frmEmployeeSignIn As New fclsEmployeeSignIn()
frmEmployeeSignIn.strdatasource = strdatasource
frmEmployeeSignIn.networkinstallation = networkinstallation
frmEmployeeSignIn.Show()
me.close()
password = InputBox("Re-enter your password. Your Password may not be left blank.", "Password Confirmation")
If password = txbPassword.Text Then
'do some stuff
End If
// Somewhere in owner form...
ChildForm frm = new ChildForm();
if (frm.ShowDialog(this) == DialogResult.OK)
// Do stuff...
// In some button click event on the child form...
this.DialogResult = DialogResult.OK; // This also implicitly closes the form.