Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
Splash screen tutorial
Messages   Related Types
This message was discovered on microsoft.public.dotnet.languages.vb.


aaron
Hello,

I was wondering if there are any tutorials for splash screen on the web for
vb.net windows app.

Aaron

Reply to this message...
Vote that this is a GOOD answer...
 
Auto-following on Twitter
Ubuntu and XP on one “desktop”
 
    
Mike McCoy
I don't know if this is a best practice, but I create a small Class called
TimerCloseRestore. It contains a timer from System.Threading, the splash
form and my main window form. The timer performs an action in the future to
close the splash dialog. This is a work in progress. If my main window
completes its load process before the splash is gone, the user can simply
click on it without worrying about the splash screen. My app starts from a
main() routine and initially asks the user to login first, so I have to deal
with a third login form.

fLogin = New frmLogin()

Application.Run(fLogin)

Later the user, after entering the password, hits the OK button on the
password dialog. I hide flogin because closing it will terminate the
application. I clean it up later if the user dismisses or closes fMDI then
I will close fLogin. I may use Application.Run(fMDI) in the future, and
then present fLogin, fSplash; however, I still seem to misunderstanding the
best way to use the Enabled, Visible and Hide properties. I'd like to avoid
a lot of application "flickering" while the app is loading its controls.
Here's what I have done.

Imports System
Imports System.Threading

'Inserted at the top of the frmLogin Class
Class TimerCloseRestore

Public tmr As Timer
Public mySplash As frmSplash
Public myWakeupForm As frmMDI

End Class

Friend Class frmLogin `Normal Class Form

Inherits System.Windows.Forms.Form

' Skipped Normal Controls, etc.

Shared Sub CloseSplash(ByVal state As [Object])
'Delegate for closing Splash
Dim s As TimerCloseRestore = CType(state, TimerCloseRestore)
If Not (s.mySplash Is Nothing) Then
s.mySplash.Close()
End If

If Not (s.myWakeupForm Is Nothing) Then
s.myWakeupForm.Visible = True 'Make sure the other form is visible
End If

If Not (s.tmr Is Nothing) Then
s.tmr.Dispose()
s.tmr = Nothing
End If
End Sub

'The password Form - OK Click
Private Sub cmdOK_Click(ByVal eventSender As System.Object, ByVal eventArgs
As System.EventArgs) Handles cmdOK.Click

Dim intResponse As Short
Static intCounter As Short
Dim s As New TimerCloseRestore()

'Err Handling

Const F_NAME As String = "cmdOK_Click"

On Error GoTo MErrHandler

OK = False
ValidateUserADO()

If (OK = True) Then
Me.Hide()

g_strUser = txtUserName.Text
Dim fMDI As New frmMDI()
Dim duetime As New TimeSpan(0, 0, 10) 'Close the Splash after Ten
Seconds

Dim fSplash As New frmSplash()
fSplash.TopMost = True 'Keep the splash on
top, until the user reorders the windows with a mouse click.
fSplash.Show()

Dim t = New System.Threading.Timer(New TimerCallback(AddressOf
CloseSplash), s, duetime, Nothing)

s.tmr = t
s.mySplash = fSplash
s.myWakeupForm = fMDI 'I was going to hid the fMDI
until it was fully ready; however, I need to figure this out still.
'In this
scenario, fMDI would make itself visible when ready or when the flash is
terminated.

fMDI.Show() 'Takes a variable amount of time to load.

loggedIn = True
Else
'Do something else if the user presented the wrong password
End If

End Sub
"aaron"
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
Outlook interop - stopping user properties appearing on Outlook message print
Seriously, why is “cut and paste” majorly newsworthy???
 
    
aaron
Mike

Thanks... this will help me

Aaron

"Mike McCoy" <Click here to reveal e-mail address> wrote in message
news:e$w#Ro9vCHA.2652@TK2MSFTNGP11...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Mike McCoy
Aaron,

No problem, one other suggestion, I noticed that the TopMost property will
keep the Splash on top regardless of the users normal mouse actions. You
can set the other former to TopMost when it is ready, intercept the GotFocus
event and set the topmost property, e.g., fMDI.TopMost=True, or just wait
for the Splash to go away. Also, I am pretty sure that CloseSplash doesn't
need to be a Shared method. This was a carryover from another experiment.
Good luck.

[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
Email Archiving and Email Filing - what’s the difference?
Web-based task/todo list management
 
 
System.EventArgs
System.Object
System.Threading.Timer
System.Threading.TimerCallback
System.TimeSpan
System.Windows.Forms.Application
System.Windows.Forms.Form




Ad
BootFX
Reliable and powerful .NET application framework.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734