By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,087 Members | 986 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,087 IT Pros & Developers. It's quick & easy.

Program flow control

P: n/a
I'm trying to create an invisible form to start my program with. It will be
the startup object; I have it set at 0% opacity, since there is no Visible
property to set for forms (at least, not that I can see... correct me if I
am wrong). What I want it to do is to create an instance of the splash
screen, show the splash screen, detect when the splash screen closes itself,
then create an instance of and show the main game screen. I'm guessing that
you can't have the control form do a me.close(), unless you want to close
the entire program, since it is the one that creates the other form
instances.

So far, I have it so that the Splash screen appears okay (thank you,
DoEvents()! ) and disappears okay. In order to determine when to create the
instance of the Game form, I'm using the following snippet of code:

While Not (Splash is Nothing)
' Wait for Splash screen to exit
DoEvents()
End While

.... This is not working. I'm sure many of you are probably laughing at me
right now... I feel like a real n00b. The timer within the Splash screen
increases the value of my ProgressBar, and when it reaches the full value,
it activates the Me.Hide() and Me.Close() code, which I had thought would
set the value of Splash to Nothing. Instead, when I pause and look at the
code, since it's still running, it shows me that Splash =
Youghtzy.frmSplash. It doesn't seem to dispose of it at all. Is there any
way I can force it to dispose, or better yet, find some way to automatically
notify the Master form that the Splash form is Closed?

Thanks,
Eric

Feb 21 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hah! Actually, I figured out one way to handle it. Instead of waiting for
(Splash is Nothing), it loops While (Splash.Visible = True), handling
DoEvents; it then, after it gets past that loop, shows the game screen. In
this fashion, I suppose, I can continue to handle things... as long as I
know which event to wait for, in what order.

What I still want to learn how to do is to have an event handler that would
look for the closing of a different form altogether. Is that possible? Can
you create an event handler if one form that only activates when a different
form is closed? For that matter, can anyone share what their optimal way of
handling such a situation is? Thank you!

"Eric A. Johnson" <no*****@dontlookforme.com> wrote in message
news:PF*******************@newssvr21.news.prodigy. com...
I'm trying to create an invisible form to start my program with. It will
be the startup object; I have it set at 0% opacity, since there is no
Visible property to set for forms (at least, not that I can see... correct
me if I am wrong). What I want it to do is to create an instance of the
splash screen, show the splash screen, detect when the splash screen
closes itself, then create an instance of and show the main game screen.
I'm guessing that you can't have the control form do a me.close(), unless
you want to close the entire program, since it is the one that creates the
other form instances.

So far, I have it so that the Splash screen appears okay (thank you,
DoEvents()! ) and disappears okay. In order to determine when to create
the instance of the Game form, I'm using the following snippet of code:

While Not (Splash is Nothing)
' Wait for Splash screen to exit
DoEvents()
End While

... This is not working. I'm sure many of you are probably laughing at me
right now... I feel like a real n00b. The timer within the Splash screen
increases the value of my ProgressBar, and when it reaches the full value,
it activates the Me.Hide() and Me.Close() code, which I had thought would
set the value of Splash to Nothing. Instead, when I pause and look at the
code, since it's still running, it shows me that Splash =
Youghtzy.frmSplash. It doesn't seem to dispose of it at all. Is there
any way I can force it to dispose, or better yet, find some way to
automatically notify the Master form that the Splash form is Closed?

Thanks,
Eric

Feb 21 '06 #2

P: n/a
CMM
Declare a private variable WithEvents and set the new form to it.

Private WithEvents m_childForm As Form

.... in some code
m_childForm = New Form2
m_childForm2.Show()

Public sub m_childForm_Closing(...) Handles m_childForm.Closing
....
End Sub

--
-C. Moya
www.cmoya.com
"Eric A. Johnson" <no*****@dontlookforme.com> wrote in message
news:dl******************@newssvr27.news.prodigy.n et...
Hah! Actually, I figured out one way to handle it. Instead of waiting
for (Splash is Nothing), it loops While (Splash.Visible = True), handling
DoEvents; it then, after it gets past that loop, shows the game screen.
In this fashion, I suppose, I can continue to handle things... as long as
I know which event to wait for, in what order.

What I still want to learn how to do is to have an event handler that
would look for the closing of a different form altogether. Is that
possible? Can you create an event handler if one form that only activates
when a different form is closed? For that matter, can anyone share what
their optimal way of handling such a situation is? Thank you!

"Eric A. Johnson" <no*****@dontlookforme.com> wrote in message
news:PF*******************@newssvr21.news.prodigy. com...
I'm trying to create an invisible form to start my program with. It will
be the startup object; I have it set at 0% opacity, since there is no
Visible property to set for forms (at least, not that I can see...
correct me if I am wrong). What I want it to do is to create an instance
of the splash screen, show the splash screen, detect when the splash
screen closes itself, then create an instance of and show the main game
screen. I'm guessing that you can't have the control form do a
me.close(), unless you want to close the entire program, since it is the
one that creates the other form instances.

So far, I have it so that the Splash screen appears okay (thank you,
DoEvents()! ) and disappears okay. In order to determine when to create
the instance of the Game form, I'm using the following snippet of code:

While Not (Splash is Nothing)
' Wait for Splash screen to exit
DoEvents()
End While

... This is not working. I'm sure many of you are probably laughing at
me right now... I feel like a real n00b. The timer within the Splash
screen increases the value of my ProgressBar, and when it reaches the
full value, it activates the Me.Hide() and Me.Close() code, which I had
thought would set the value of Splash to Nothing. Instead, when I pause
and look at the code, since it's still running, it shows me that Splash =
Youghtzy.frmSplash. It doesn't seem to dispose of it at all. Is there
any way I can force it to dispose, or better yet, find some way to
automatically notify the Master form that the Splash form is Closed?

Thanks,
Eric


Feb 21 '06 #3

P: n/a
Eric,

If you search this newsgroup than you can see tons of samples with Splash
screens or whatever.

However I have now made a new one which is as simple as can be and have put
it on our website. You can try it.

http://www.vb-tips.com/default.aspx?...f-cfc96c6ca913

I hope this helps,

Cor
Feb 21 '06 #4

P: n/a
That is exactly what I needed! :-D Thank you ever so much. I shall be
certain to remember this.

-- Eric

"CMM" <cm*@nospam.com> wrote in message
news:u2*************@TK2MSFTNGP14.phx.gbl...
Declare a private variable WithEvents and set the new form to it.

Private WithEvents m_childForm As Form

... in some code
m_childForm = New Form2
m_childForm2.Show()

Public sub m_childForm_Closing(...) Handles m_childForm.Closing
...
End Sub

--
-C. Moya
www.cmoya.com
"Eric A. Johnson" <no*****@dontlookforme.com> wrote in message
news:dl******************@newssvr27.news.prodigy.n et...
Hah! Actually, I figured out one way to handle it. Instead of waiting
for (Splash is Nothing), it loops While (Splash.Visible = True), handling
DoEvents; it then, after it gets past that loop, shows the game screen.
In this fashion, I suppose, I can continue to handle things... as long as
I know which event to wait for, in what order.

What I still want to learn how to do is to have an event handler that
would look for the closing of a different form altogether. Is that
possible? Can you create an event handler if one form that only
activates when a different form is closed? For that matter, can anyone
share what their optimal way of handling such a situation is? Thank you!

"Eric A. Johnson" <no*****@dontlookforme.com> wrote in message
news:PF*******************@newssvr21.news.prodigy. com...
I'm trying to create an invisible form to start my program with. It
will be the startup object; I have it set at 0% opacity, since there is
no Visible property to set for forms (at least, not that I can see...
correct me if I am wrong). What I want it to do is to create an
instance of the splash screen, show the splash screen, detect when the
splash screen closes itself, then create an instance of and show the
main game screen. I'm guessing that you can't have the control form do a
me.close(), unless you want to close the entire program, since it is the
one that creates the other form instances.

So far, I have it so that the Splash screen appears okay (thank you,
DoEvents()! ) and disappears okay. In order to determine when to create
the instance of the Game form, I'm using the following snippet of code:

While Not (Splash is Nothing)
' Wait for Splash screen to exit
DoEvents()
End While

... This is not working. I'm sure many of you are probably laughing at
me right now... I feel like a real n00b. The timer within the Splash
screen increases the value of my ProgressBar, and when it reaches the
full value, it activates the Me.Hide() and Me.Close() code, which I had
thought would set the value of Splash to Nothing. Instead, when I pause
and look at the code, since it's still running, it shows me that Splash
= Youghtzy.frmSplash. It doesn't seem to dispose of it at all. Is
there any way I can force it to dispose, or better yet, find some way to
automatically notify the Master form that the Splash form is Closed?

Thanks,
Eric



Feb 21 '06 #5

P: n/a
Eric,

Will you please be so kind to response next time to the original questions.
I thought that I had seen your question before and now I saw it. This is
really anoying for the ones who answer because they have to start everytime
new or don't see the answers from others.

Thanks in advance.

Cor
Feb 21 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.