splash screen, VB.NET MDI APP--wierd problem

  • Thread starter Thread starter SStory
  • Start date Start date
S

SStory

I am trying to make a splash screen for my vb.net app.
It is an mdi app.

including the splash code produces wierd results.

not inluding makes things fine.

Also have tried loading the splash form from:

* load event of main mdi parent
* sub main in a module
* my own application class
if I load the splash form using splashform.show
and then load MDI main form using showdialog.

show dialog doesn't seem to be (modal/modeless--can't remember term--doesn't
stick around)
it just exits shortly after loading--probably after processing form_load
code--and continues with the line after .showdialog.

Does anyone have any ideas.

Splash form is not real complicated--has a timer to close.

What is the proper way to do a splash screen in VB.NET?

I want it to show first thing but not prohibit loading of main app.

Thanks,

Shane
 
follow-up thought...

my idea of a splash screen isn't to waste load time using .showdialog

but to occupy an impatient user for a few seconds and display needed info
while the real deal is loading.

Shane
 
extremely helpful!

didn't implement the whole thing but multithreaded the about.

I find that at least for an MDI app, that in the Debug environment, after
the splash goes away, it minmizes the MDI main window.

doesn't seem to do that in release though.

I will followup if I have more issues.

Thank you,

Shane
 
thanks Armin,

I had tried that, but running on a seperate thread seems to work better all
around.

otherwise my main app window, which is called from a mod, finishes--even if
I used

ShowDialog....

Erik's link helped me find a solution--at least I think so... more later if
I have problems.

thanks again,

Shane
 
Well,

Seems to work except that when the splash form closes it minimizes the main
MDI app form.

Strange behavior.

Shane
 
SStory said:
Well,

Seems to work except that when the splash form closes it minimizes the main
MDI app form.

Strange behavior.

Shane

I've seen this before. If you want to post some of your relevant
startup code I'd be happy to take a look at it.

Erik
 
Hello,

I thought this splash screen tutorial was great so I tried it out. But one
question is, when the splash screen is up, how can you disable the ability
to close the form using the ALT + F4 key combination??
 
I'm not sure if you can trap ALT+F4 in the keydown event or not.... Turn on
keypreview on that form and try trapping for ALT+F4 and doing nothing.

If that doesn't work, I don't really know.

Shane
 
Webster said:
Hello,

I thought this splash screen tutorial was great so I tried it out. But one
question is, when the splash screen is up, how can you disable the ability
to close the form using the ALT + F4 key combination??

Set e.Cancel = true in the Form.Closing event.

Erik
 
Webster said:
but then how would I close it after all?

There are a number of ways. You could use the Timer control. If you
want the splash screen to sit there for 5 seconds, set the Interval to 5000,
then in the Timer.Tick event, set a private boolean class variable and close
the form:

okToClose = True
Me.Close()

Then modify your Form.Closing event:

If (Not okToClose)
e.Cancel = True
End If

Erik
 
There are a number of ways. You could use the Timer control. If you
want the splash screen to sit there for 5 seconds, set the Interval to 5000,
then in the Timer.Tick event, set a private boolean class variable and close
the form:

okToClose = True
Me.Close()

Then modify your Form.Closing event:

If (Not okToClose)
e.Cancel = True
End If

Cool.. in this way I can use it to trap the Alt-F4 combination like I
wanted...

' for trapping ALT+F4 combination
Dim AltF4 As Boolean

' prevent alt+f4 to close form prematurely
Private Sub SplashScreen_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If AltF4 Then
e.Cancel = True
End If
End Sub

' trap the alt-f4 combination
Private Sub SplashScreen_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
' check for alt-f4 combination
If e.Modifiers = Keys.Alt And e.KeyCode = Keys.F4 Then
AltF4 = True
End If
End Sub


Thanks a lot!!
 
Back
Top