
Dialog to close Main Form
I have a dialog box coming up before main form loads fully. Which is what I
want
Public Class frmMainWindow
Inherits System.Windows.Forms.Form
Private Sub frmMainWindow_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim Logon As New frmLogonBox()
Logon.ShowDialog()
End Sub
End Class
I want the Main form to quit loading and the program to end if the Person
chooses the cancel button of the Dialog Box. The btnClose_click event is the
cancel button. So far the frmMainWindow loads fully. How do I make it so it
does not load at all and the program quits? Your help is greatly
appreciated.
Public Class frmLogonBox
Inherits System.Windows.Forms.Form
Public Sub btnClose_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnClose.Click
Me.Close()
MessageBox.Show("You cannot enter the program without a password!", "Cancel
Message", MessageBoxButtons.OK)
End Sub
End Class