Splash screen without Application.Run() possible?

G

Guest

Hi

I want to add a splash screen to my application and searching this newsgroup
I found the following article
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/casoast.asp
helpful. The splash code requires calling Application.Run() to allow the main
form to continue working. But as my application can start with command line
arguments which requires the following code:

Shared Sub Main(ByVal args() As String)
Application.Run(new frmMain)
…
End Sub

and since .NET CF cannot do more than one Application.Run I’m stuck… anyone
know a workaround?

Thanks

Gavin
 
G

Guest

You must have an Application.Run call, but I have no idea why you're
confused. Save the command line parameters or pass them to the form before
calling Run.

-Chris
 
G

Guest

Yes I’m confused as I cannot figure how to create splash screen (form) and
show it on a thread allowing the main form to continue initializing. Below is
a sample code. Most of the code is from the MSDN splash sample except for
Public Shared Sub Main(ByVal cmdArgs() As String) which my application needs…
as from my original post, .NET CF cannot do more than one Application.Run.

Public NotInheritable Class frmMain
Public Shared Sub Main(ByVal cmdArgs() As String)
If cmdArgs.Length > 0 Then
‘Store cmdArgs ...
End If

Application.Run(New frmMain())
End Sub

Public Sub New()
Dim splashThread As Threading.Thread = New Threading.Thread(New
Threading.ThreadStart(AddressOf StartSplash))
splashThread.Start()

‘Continue initializeing form
End Sub

Private Sub StartSplash()
splashDialog = New frmSplash
Application.Run(splashDialog)
End Sub

‘Rest of code...
End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top