473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Program flow control

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
5 1237
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Will Stuyvesant | last post by:
I never used the popen or popen2 libraries but it is my understanding that they can capture the output of console based programs. Is it also possible to send keystrokes to console base programs? ...
11
by: Robert Bowen | last post by:
Hello all. I have been given mock-ups (in static HTML) of some pages for a site I am working on. The client would like these pages to look exactly as they do now. The problem is that the content is...
4
by: John L | last post by:
Hello! I'm somewhat new to C, and the problem is I'm not sure how to structure my programs. I keep ending up with massively long main() functions that look like this: int main(void) {...
7
by: jacob navia | last post by:
Suppose that you want to know where your program has passed, i.e. the exact flow of the program. A brute force solution is to make an array of n lines, n being the number of lines in the...
5
by: Miyra | last post by:
Hi. I'm working with an app that uses exceptions for control flow. These are code blocks where exceptions are thrown/caught regularly. A couple hundred exceptions occur per hour and they're caught...
1
by: Brett | last post by:
I'd like to have all of my documentation in one place. I use the following for documenting code: - attributes for certain types of documentation - use of the C# generated inline XML...
2
by: brianlum | last post by:
Hi, I have been looking for a good way to convert python code into a control flow graph. I know of Python functions that will convert an expression into an abstract syntax tree (i.e. ast =...
7
by: Buck Rogers | last post by:
Hi all! Newbie here. Below is an example from Teach Yourself C in 21 Days. My apologies if it is a bit long. What I don't understand is how the "get_data" function can call the...
8
by: lovecreatesbea... | last post by:
K&R 2, sec 2.4 says: If the variable in question is not automatic, the initialization is done once only, conceptually before the program starts executing, ... . "Non-automatic variables are...
3
by: 100grand | last post by:
Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.