Hi Richard,
Based on my understanding, when you run your application, you'd like to
display a splash screen first and then the login form. A successful login
closes the login form is closed and shows the main form. If I'm off base,
please feel free to let me know.
It seems that you're using VB.NET. In VB.NET, we could enable application
framework and sepecify a splash screen form.
When the application is run, the Startup event handler of application(if
any) is executed first and immediately the splash screen form is shown, not
waiting for the Startup event handler finishes the execution.
After the application's Startup event handler finishes the execution, the
startup form is created and the Load event handler of the startup form is
called(if any). Note that the splash screen form won't be closed until the
Load event handler of the startup form finishes the execution.
If you set the main form as the startup form and show the login form when
the main form is loaded, it makes sense that the splash screen form is not
closed while the login form is opend.
I suggest that you close the splash screen form before you show the login
form in the main form's Load event handler. The following is a sample.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' welcome is the name of the splash screen form
CType(My.Application.SplashScreen, welcome).CloseForm()
Dim frm As New logon
If (frm.ShowDialog() = Windows.Forms.DialogResult.Cancel) Then
Application.Exit()
End If
End Sub
Public Class welcome
Delegate Sub DelegateToCloseForm()
' if the welcome form is closed by the main form, it is cross-thread
operation. so we need to use the Invoke method to deal with it.
Public Sub CloseForm()
If (Me.InvokeRequired) Then
Me.Invoke(New DelegateToCloseForm(AddressOf CloseForm))
Else
Me.Close()
End If
End Sub
End Class
Hope this helps.
If you have anything unclear, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.