Alex,
As OHM stated. You can use ShowDialog on your form.
In addition to manually calling me.Hide within the 'Submit' button, you can
have the form take care of it.
To do this you need to:
1. Set the Control.DialogResult value for your Submit/Ok button to
DialogResult.Ok
2. Set the Control.DialogResult value for your Cancel button to
DialogResult.Cancel
3. Set the Form.AcceptButton to your Submit/Ok button
4. Set the Form.CancelButton to your Cancel button
Then the form will take care of everything for you. Which ever button your
press will be the value returned from the ShowDialog call.
Dim dialog As MyDialog1
Select Case dialog.ShowDialog()
Case DialogResult.Ok
' the Submit/Ok button was pressed
Case DialogResult.Cancel
' the Submit/Ok button was pressed
' most of the time you just want to ignore cancel...
End Select
dialog.Dispose()
You can set other buttons to the other values of DialogResult and they will
be returned also. The Form's AcceptButton & CancelButton properties enable
Enter & Esc on the keyboard to be used for those buttons.
Then as OHM & Ed stated, your form class would expose properties to get the
values entered. You can use Properties to set any initial values. Similar to
how OpenFileDialog works.
Remember to call the Dispose method on your form, when you are done so that
it gets cleaned up.
Hope this helps
Jay