Home All Groups Group Topic Archive Search About
Author
17 Mar 2006 6:08 PM
G .Net
Hi

Firstly, can I apologise if this has already been answered. Something odd
has happened because I sent this a couple of days ago (it is in my sent
folder) but I can't seem to see it on the newsgroup (which reminds me, I'm
using Outlook Express - is there a better newsgroup reader that others could
recommened?)

Anyway, here is my original question:

How can I tell if a form has been closed using the red cross in the top
right of the form rather than, for example, pressing an OK button?

Geoff

Author
17 Mar 2006 8:46 PM
VHD50
This is fairly simple... :)
1. Declare a global var and set it to some value, like
Dim OKBtnClick As Boolean = False
2. In your OKButton_Click sub, set OKBtnClick = True
3. In the form_Closing event sub, check the value of OKBtnClick. If it's
False then you know the user click the red x button in the corner of the form.
There are other more complicated ways... It's up to you to decide what to
use though :)
Hope this helps,
VHD50.


Show quoteHide quote
"G .Net" wrote:

> Hi
>
> Firstly, can I apologise if this has already been answered. Something odd
> has happened because I sent this a couple of days ago (it is in my sent
> folder) but I can't seem to see it on the newsgroup (which reminds me, I'm
> using Outlook Express - is there a better newsgroup reader that others could
> recommened?)
>
> Anyway, here is my original question:
>
> How can I tell if a form has been closed using the red cross in the top
> right of the form rather than, for example, pressing an OK button?
>
> Geoff
>
>
>
Author
17 Mar 2006 10:04 PM
Brian Shafer
is there no .. what was in VB Classic .. QueryUnLoad?

Show quoteHide quote
"VHD50" wrote:

> This is fairly simple... :)
> 1. Declare a global var and set it to some value, like
> Dim OKBtnClick As Boolean = False
> 2. In your OKButton_Click sub, set OKBtnClick = True
> 3. In the form_Closing event sub, check the value of OKBtnClick. If it's
> False then you know the user click the red x button in the corner of the form.
> There are other more complicated ways... It's up to you to decide what to
> use though :)
> Hope this helps,
> VHD50.
>
>
> "G .Net" wrote:
>
> > Hi
> >
> > Firstly, can I apologise if this has already been answered. Something odd
> > has happened because I sent this a couple of days ago (it is in my sent
> > folder) but I can't seem to see it on the newsgroup (which reminds me, I'm
> > using Outlook Express - is there a better newsgroup reader that others could
> > recommened?)
> >
> > Anyway, here is my original question:
> >
> > How can I tell if a form has been closed using the red cross in the top
> > right of the form rather than, for example, pressing an OK button?
> >
> > Geoff
> >
> >
> >