How to hide a modal dialog without returning from .ShowDialog?
If you hide the dialog, you will return from ShowDialog(). Forget about trying to change that, you can't.
You might be able to minimize the dialog.
form1.WindowState = FormWindowState.Minimized;
Or you can position it off screen.
form.Left = -16384;
Or you can make it transparent Modifying opacity of any window from C#
You cannot make this work, ShowDialog() will always return when the form is hidden. The trick is to use a regular form and a normal call to Application.Run() but to prevent it from becoming visible immediately. Paste this code into your form class:
Protected Overrides Sub SetVisibleCore(ByVal value As Boolean)
If Not IsHandleCreated Then
CreateHandle()
value = false
End If
MyBase.SetVisibleCore(value)
End Sub
Beware that your Load event handler won't run until the form actually becomes visible so be sure to do any initialization in the Sub New constructor.