The form has a built-in method for doing this. When you call ShowDialog() on a form, it returns one of many dialog result constants, the most common of which are Ok and Cancel.
In your form, as soon as you set the dialogresult, the form will hide and code will return to the calling procedure.
DialogResult = DialogResult.Cancel
'or
DialogResult = DialogResult.Ok