Link to home
Start Free TrialLog in
Avatar of LydaRA
LydaRA

asked on

VB.Net Splash Screen On Seperate Thread

Does anyone have a sample of a VB.Net splash screen launched on a seperate thread?  I need it to be interactive while the main app loads a large dataset.  My poor attempts don't load until after the main app, and then immediately closes without user action...

Robert
Avatar of iboutchkine
iboutchkine

try this

'add new form fmSplash ( it will be your splash screen)

Imports System.Threading

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "
#End Region

    Shared thrSplash As Thread


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim clsSplash As New cThreadSplash()
        thrSplash = New Thread(New ThreadStart(AddressOf clsSplash.thSplashDisplay))
        thrSplash.Start()
    End Sub
End Class

Public Class cThreadSplash
    Public Sub thSplashDisplay()
        Dim f As New fmSpalsh()
        f.Text = "Splash Screen"
        Try
            f.ShowDialog()
        Catch es As ThreadAbortException
            Thread.ResetAbort()
        Catch
        End Try
    End Sub
End Class


   
Avatar of Howard Cantrell
Typo

Instead of

 Dim f As New fmSpalsh()
in the Public Sub thSplashDisplay()

write

 Dim f As New fmSplash()
                         ---------
Avatar of LydaRA

ASKER

iboutchkine's exmple appears to work in standalone project.  It is simpler than what I have been trying.  However the splash form does not appear until _after_ the main form in my real project.  Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of iboutchkine
iboutchkine

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial