Splash as the startup object locks the form

G

Guest

I'm trying to use the Splash screen, but I observed a strange behavior. If I
specify the SplashForm as my startup object, the MainForm loads fine except
it's got a menu and when I click on the menu option (which loads another
form, such as About) none of the buttons - OK button in the upper right-hand
corner and the buttons on my About form - works. It seems the About form is
locked. It works fine if my startup object is MainForm, which I don't want to
be the case because launching the SplashForm in MainForm_Load event seems to
be slower.
I don't know how to explain this behavior...

Private Sub Splash_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.Show() : Application.DoEvents()
Dim mainFrm As New MainForm
mainFrm.LoadMainForm() 'here I load the grid with data, I want to
show the form only after it is loaded
Me.Close()
mainFrm.ShowDialog()
End Sub
 
G

Guest

If I try using a module as your startup object and load the Splash and
MainForm from there, I get the same results.

Also, this locking problem is not menu specific.
I noticed that when I load another form from the MainForm not through the
menu, the OK button in the upper-right hand corner doesn't work either (but
the buttons on the form work).

I can't even close this task...
 
G

Guest

Here's what I did (and it works):
1. In Module1, I added Main() and set it as my startup object:
Public splashFrm As New Splash
Public mainFrm As New MainForm

Sub Main()
splashFrm.Show()
Application.DoEvents()
Application.Run(New mainFrm)
End Sub

2. I removed Splash_Load routine.
3. In MainForm_Load routine, I put this:
....
Me.Show()
splashFrm.Close()
....
 

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

Top