Results 1 to 3 of 3

Thread: Adding a splash screen in VB.Net

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    Adding a splash screen in VB.Net

    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
    steve

  2. #2
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    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:
    1. Me.Opacity = 0
    2.  
    3.         'Show splash screen
    4.         Dim frmSplash As New Splash()
    5.         frmSplash.Show()
    6.         frmSplash.Refresh()
    7.  
    8.         'Do start-up stuff
    9.  
    10.         Me.Opacity = 100


    This code in the Load event of the Splash form:
    Note - Splash must import System.Threading.

    VB Code:
    1. 'Start a new thread that will cause the splash screen to
    2.         'close after a delay.
    3.         Dim thrd As New Thread(AddressOf CloseAfterDelay)
    4.         thrd.Start()

    This code also in Splash:

    VB Code:
    1. Private Sub CloseAfterDelay()
    2.         Dim time As Date = Now
    3.         Do
    4.             'nothing
    5.         Loop While Now < time.AddMilliseconds(1000)
    6.         Me.Close()
    7.     End Sub
    8.  
    9.     Private Sub Splash_KeyDown(ByVal sender As Object, _
    10.                                ByVal e As System.Windows.Forms.KeyEventArgs) _
    11.                                                         Handles MyBase.KeyDown
    12.         'Close the splash screen if the user hits a key.
    13.         Me.Close()
    14.     End Sub
    15.  
    16.     Private Sub Splash_MouseDown(ByVal sender As Object, _
    17.                             ByVal e As System.Windows.Forms.MouseEventArgs) _
    18.                                                         Handles MyBase.MouseDown
    19.         'Close the splash screen if the user clicks it with the mouse.
    20.         Me.Close()
    21.     End Sub
    This world is not my home. I'm just passing through.

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Use :

    VB Code:
    1. frmSplash.ShowDialog(Me)

    instead of

    VB Code:
    1. frmSplash.Show()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width