Q: Closing a form

  • Thread starter Thread starter G .Net
  • Start date Start date
G

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
 
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.
 
Back
Top