mpappert
Well-known member
In reading some of the other posts about when the main form closes it terminates the application, Ive had to take a different methodology to my login screen.
Ive modified my frmMain as follows:
[VB]
Public Sub New()
MyBase.New()
Show Login Screen and Validate Credentials
Dim Login As frmLogin
Login = New frmLogin()
Login.ShowDialog(Me)
This call is required by the Windows Form Designer.
InitializeComponent()
...
[/VB]
Ive also created a public property called "LoggedIn" which contains a boolean value.
What I would like to do is after the .ShowDialog returns the control to frmMain, check to see if this value is True, if so continue, if not terminate.
Ive tried the following code but it generates an exception error:
[VB]
Public Sub New()
MyBase.New()
Show Login Screen and Validate Credentials
Dim Login As frmLogin
Login = New frmLogin()
Login.ShowDialog(Me)
If Not Global.blnLoggedIn Then
Me.Close()
End If
This call is required by the Windows Form Designer.
InitializeComponent()
...
[/VB]
I know I could call the frmLogin from within the frmMain_Load sub, but I dont want the main form to show before the person enters their credentials. The workflow would have looked something like this:
Any ideas? TIA!
M.
Ive modified my frmMain as follows:
[VB]
Public Sub New()
MyBase.New()
Show Login Screen and Validate Credentials
Dim Login As frmLogin
Login = New frmLogin()
Login.ShowDialog(Me)
This call is required by the Windows Form Designer.
InitializeComponent()
...
[/VB]
Ive also created a public property called "LoggedIn" which contains a boolean value.
What I would like to do is after the .ShowDialog returns the control to frmMain, check to see if this value is True, if so continue, if not terminate.
Ive tried the following code but it generates an exception error:
[VB]
Public Sub New()
MyBase.New()
Show Login Screen and Validate Credentials
Dim Login As frmLogin
Login = New frmLogin()
Login.ShowDialog(Me)
If Not Global.blnLoggedIn Then
Me.Close()
End If
This call is required by the Windows Form Designer.
InitializeComponent()
...
[/VB]
I know I could call the frmLogin from within the frmMain_Load sub, but I dont want the main form to show before the person enters their credentials. The workflow would have looked something like this:
Code:
1: LoginScreen displayed to user
2: Credentials entered are validated
3: If credentials are valid, goto frmMain and close LoginScreen
4: else stay on this screen for three retries, then end
Any ideas? TIA!
M.