hi,
How do I capture the closing events coming from the 'X' icon in the
top-right corner of a form and the
Form.Close() command?
I want to be able to differentiate between the Closing Event coming from the
'X' icon in the top-right corner of a form and the closing event coming from
the Form.Close() command.
I don't want the user to be able to close the application by clicking on the
"X" icon on the top-right corner in a form so I override the Closing event
but I want the form to close when Form.Close() is called.
In Wisual Basic 6.0, I used to do it by checking the Unload Mode against
vbFormControMen u variable.
Thanks,
Scott 4 2408
Hi Hang,
This is probably not the most elegant way to do this, but this will work:
1. set a public variable in the declarations section of the form with
Public closetest As Boolean = True
2. in the close button event, enter
closetest = False
Me.Close()
3. in the closing event of the form enter
If closetest = True Then
e.Cancel = True
End If
HTH,
Bernie Yaeger
"HANG LAM" <ha*****@hotmai l.com> wrote in message
news:uk******** ******@TK2MSFTN GP12.phx.gbl... hi,
How do I capture the closing events coming from the 'X' icon in the top-right corner of a form and the Form.Close() command? I want to be able to differentiate between the Closing Event coming from
the 'X' icon in the top-right corner of a form and the closing event coming
from the Form.Close() command.
I don't want the user to be able to close the application by clicking on
the "X" icon on the top-right corner in a form so I override the Closing event but I want the form to close when Form.Close() is called.
In Wisual Basic 6.0, I used to do it by checking the Unload Mode against vbFormControMen u variable.
Thanks, Scott
Hi Hang,
This is probably not the most elegant way to do this, but this will work:
1. set a public variable in the declarations section of the form with
Public closetest As Boolean = True
2. in the close button event, enter
closetest = False
Me.Close()
3. in the closing event of the form enter
If closetest = True Then
e.Cancel = True
End If
HTH,
Bernie Yaeger
"HANG LAM" <ha*****@hotmai l.com> wrote in message
news:uk******** ******@TK2MSFTN GP12.phx.gbl... hi,
How do I capture the closing events coming from the 'X' icon in the top-right corner of a form and the Form.Close() command? I want to be able to differentiate between the Closing Event coming from
the 'X' icon in the top-right corner of a form and the closing event coming
from the Form.Close() command.
I don't want the user to be able to close the application by clicking on
the "X" icon on the top-right corner in a form so I override the Closing event but I want the form to close when Form.Close() is called.
In Wisual Basic 6.0, I used to do it by checking the Unload Mode against vbFormControMen u variable.
Thanks, Scott
On 2004-04-06, HANG LAM <ha*****@hotmai l.com> wrote: hi,
How do I capture the closing events coming from the 'X' icon in the top-right corner of a form and the Form.Close() command? I want to be able to differentiate between the Closing Event coming from the 'X' icon in the top-right corner of a form and the closing event coming from the Form.Close() command.
I don't want the user to be able to close the application by clicking on the "X" icon on the top-right corner in a form so I override the Closing event but I want the form to close when Form.Close() is called.
In Wisual Basic 6.0, I used to do it by checking the Unload Mode against vbFormControMen u variable.
Thanks, Scott
Here's an article that discusses one way to accomplish this... http://www.fawcette.com/archives/pre...111/qa0111.asp
HTH
--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
Even bytes get lonely for a little bit.
On 2004-04-06, HANG LAM <ha*****@hotmai l.com> wrote: hi,
How do I capture the closing events coming from the 'X' icon in the top-right corner of a form and the Form.Close() command? I want to be able to differentiate between the Closing Event coming from the 'X' icon in the top-right corner of a form and the closing event coming from the Form.Close() command.
I don't want the user to be able to close the application by clicking on the "X" icon on the top-right corner in a form so I override the Closing event but I want the form to close when Form.Close() is called.
In Wisual Basic 6.0, I used to do it by checking the Unload Mode against vbFormControMen u variable.
Thanks, Scott
Here's an article that discusses one way to accomplish this... http://www.fawcette.com/archives/pre...111/qa0111.asp
HTH
--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
Even bytes get lonely for a little bit. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: HANG LAM |
last post by:
hi,
How do I capture the closing events coming from the 'X' icon in the
top-right corner of a form and the
Form.Close() command?
I want to be able to differentiate between the Closing Event coming from the
'X' icon in the top-right corner of a form and the closing event coming from
the Form.Close() command.
I don't want the user to be able to close the application by clicking on the
|
by: Chris Bruce |
last post by:
In my application I need a way to distiguish between the following events:
1. When a user closes an MDI child window.
2. When the user closes the MDI parent window which subsequently closes
the MDI child window.
My application does certain logic when the user actually closes the MDI
child form by clicking the "X" in the upper right hand. My application,
however, should not execute this logic if the user closes the MDI parent. I...
|
by: Barry Gast |
last post by:
Hi. I have an MDI Parent form with multiple child windows. When I close
the parent form, the Closing events of the children forms are not executing.
Do I have to close all the child forms in the parent's closing event in
order to get the closing events of the children forms to execute?
Thanks.
-Barry
|
by: HANG LAM |
last post by:
hi,
How do I capture the closing events coming from the 'X' icon in the
top-right corner of a form and the
Form.Close() command?
I want to be able to differentiate between the Closing Event coming from the
'X' icon in the top-right corner of a form and the closing event coming from
the Form.Close() command.
I don't want the user to be able to close the application by clicking on the
|
by: Charles Law |
last post by:
For some reason, when I click the X to close my MDI parent form, the action
appears to be re-directed to one of the MDI child forms, and the parent
remains open. I am then unable to close the application.
What should happen, is that the main MDI form should close, taking the child
forms with it. There is code to loop through the child forms, remove the
controls on each of them, and then close the form, but this code should
execute only...
| |
by: Marius Groenendijk |
last post by:
Dear Group,
I have a MDI with children which may be editing data.
If a MDI child closes its Closing handler asks a question 'exit w/out
saving?'.
On closing the MDI its pops a question 'Exit app?'.
If the MDI closes *first* the questions asked by the MDI children appear
and *then* the question by the MDI. This is because the closing events in
the MDI children get fired *first* while Closing the MDI.
|
by: G .Net |
last post by:
Hi
I'm soooo sorry but I've had to re-post this message again. I have no idea
what has been happening but for some reason I couldn't seem to be able to
see messages that I'd posted earlier.
My question is this - how can I determine if a user clicked the cross in the
top right of the form to close it.
Thanks in advance (and sorry again for re-posting)
|
by: Academic |
last post by:
Does it make sense to put this
If e.Cancel Then Exit Sub
at the beginning of form closing events so if the user cancels the app's
exiting in one Closing routine he will not be asked again by another when
its form Closing routine is run?
I guess what I'm asking is will that work. If one form sets e.cancelled to
true will e.cancel be true when the next form receives a closing event?
|
by: zacks |
last post by:
I have a .NET 2.0 MDI application where the child form has a Tab
Control. Each of the Tab in the Tab Control has a Validating event to
handle what it should do when the user changes tabs.
But these Validating Events are also fired when either the child form
or the main (parent) form Close icon is clicked. And I need for these
events to know if they are being invoked because the app (or child
window) is being closed. I have set a boolean...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |