Home All Groups Group Topic Archive Search About
Author
21 Feb 2006 5:36 AM
Eric A. Johnson
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

Author
21 Feb 2006 6:23 AM
Eric A. Johnson
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!

Show quoteHide quote
"Eric A. Johnson" <noth***@dontlookforme.com> wrote in message
news:PFxKf.50873$dW3.11195@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
>
>
>
Author
21 Feb 2006 6:44 AM
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
Show quoteHide quote
"Eric A. Johnson" <noth***@dontlookforme.com> wrote in message
news:dlyKf.10900$rL5.4924@newssvr27.news.prodigy.net...
> 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" <noth***@dontlookforme.com> wrote in message
> news:PFxKf.50873$dW3.11195@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
>>
>>
>>
>
>
Author
21 Feb 2006 7:30 AM
Eric A. Johnson
That is exactly what I needed! :-D  Thank you ever so much.  I shall be
certain to remember this.

-- Eric

Show quoteHide quote
"CMM" <cmm@nospam.com> wrote in message
news:u2vp3IrNGHA.720@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" <noth***@dontlookforme.com> wrote in message
> news:dlyKf.10900$rL5.4924@newssvr27.news.prodigy.net...
>> 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" <noth***@dontlookforme.com> wrote in message
>> news:PFxKf.50873$dW3.11195@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
>>>
>>>
>>>
>>
>>
>
>
Author
21 Feb 2006 7:02 AM
Cor Ligthert [MVP]
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?ID=e712f49d-7f54-4f59-945f-cfc96c6ca913

I hope this helps,

Cor
Author
21 Feb 2006 7:32 AM
Cor Ligthert [MVP]
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