Hello
Can anyone tell me how to add a splash screen in VB.Net. In VB6 it was very easy.
How about the other addins, like about box, login box, browser. Are they still in VB.Net.
Many thanks in advance
Steve
Printable View
Hello
Can anyone tell me how to add a splash screen in VB.Net. In VB6 it was very easy.
How about the other addins, like about box, login box, browser. Are they still in VB.Net.
Many thanks in advance
Steve
This is what I've done. Don't really like it a lot, but it seems to work.
This code in the Load event of your main form:
VB Code:
Me.Opacity = 0 'Show splash screen Dim frmSplash As New Splash() frmSplash.Show() frmSplash.Refresh() 'Do start-up stuff Me.Opacity = 100
This code in the Load event of the Splash form:
Note - Splash must import System.Threading.
VB Code:
'Start a new thread that will cause the splash screen to 'close after a delay. Dim thrd As New Thread(AddressOf CloseAfterDelay) thrd.Start()
This code also in Splash:
VB Code:
Private Sub CloseAfterDelay() Dim time As Date = Now Do 'nothing Loop While Now < time.AddMilliseconds(1000) Me.Close() End Sub Private Sub Splash_KeyDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyEventArgs) _ Handles MyBase.KeyDown 'Close the splash screen if the user hits a key. Me.Close() End Sub Private Sub Splash_MouseDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.MouseEventArgs) _ Handles MyBase.MouseDown 'Close the splash screen if the user clicks it with the mouse. Me.Close() End Sub
Use :
VB Code:
frmSplash.ShowDialog(Me)
instead of
VB Code:
frmSplash.Show()