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)
Goeff 9 1524
"G .Net" <no********@ema il.com> schrieb 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)
And what if he closes it from the window menu or by pressing Alt+F4 or by
pressing a Close-Button? Does it make a difference?
Maybe you're looking for the Closing or Closed events.
Armin
Hi Armin
I think that the events Close and Closing occur whatever way the form has
closed e.g. if there is button with DialogResult Ok then it will still
trigger the above. I need to know the form has been closed by clicking the
cross.
Geoff
"Armin Zingler" <az*******@free net.de> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. "G .Net" <no********@ema il.com> schrieb 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)
And what if he closes it from the window menu or by pressing Alt+F4 or by pressing a Close-Button? Does it make a difference?
Maybe you're looking for the Closing or Closed events.
Armin
As far as I know, the .Net framework does not recognise a difference
between the different possible ways of closing a form.
It might not even be possible at a low level to distinguish them - say,
each method just sends a WM_CLOSE message.
However, as Armin indicated, if you could give more information about
why knowing whether the form was closed this way is important, perhaps
someone could suggest another way to achieve your desired result.
hth,
Alan.
Hi
Interesting.
I've thought of a way to do it. Basically, I'm going to create a boolean
which will be set to true if some buttons are pressed otherwise it will be
left as false. I can then check the variable in the OnClose event which will
give the functionality I require.
The reason I am trying this is that I want to re-set some global variables
if, for example, a cancel button is pressed.
Geoff
"AlanT" <al*******@user s.com> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.com... As far as I know, the .Net framework does not recognise a difference between the different possible ways of closing a form.
It might not even be possible at a low level to distinguish them - say, each method just sends a WM_CLOSE message.
However, as Armin indicated, if you could give more information about why knowing whether the form was closed this way is important, perhaps someone could suggest another way to achieve your desired result.
hth, Alan.
"G .Net" <no********@ema il.com> schrieb Hi Armin
I think that the events Close and Closing occur whatever way the form has closed e.g. if there is button with DialogResult Ok then it will still trigger the above. I need to know the form has been closed by clicking the cross.
If you're using VB 2005, you could handle the FormClosing event and look at
e.CloseReason.
I still don't know if you want to distinguish between the cross and the
window menu and Alt+F4. If this is all the same and there is only a
difference to the button, then you could evaluate the Dialogresult property,
which is only Dialogresult.Ok if you used the button.
Armin
> As far as I know, the .Net framework does not recognise a difference between the different possible ways of closing a form.
It may not know the difference between Alt-F4 and closing the form, but it
can offer some assistance. In the FormClosing event, you can check the CloseReason
property of the event arg for some ideas. It will tell you if the reason
is due to MDIParent closing, OS shutdown, etc. It does not distinguish between
form closing by the user selecting the X, Alt-F4, and me.close() in a btnOk.Click
handler however.
Jim Wooley http://devauthority.com/blogs/jwooley
> 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.
FWIW, you can browse to the original message thread at http://groups.google.com/group/micro...0e849bc599d7fc
Jim Wooley http://devauthority.com/blogs/jwooley
Cheers Jim
"Jim Wooley" <ji************ *@hotmail.com> wrote in message
news:24******** *************** **@msnews.micro soft.com... 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.
FWIW, you can browse to the original message thread at http://groups.google.com/group/micro...0e849bc599d7fc
Jim Wooley http://devauthority.com/blogs/jwooley
Thanks everybody for all your help.
Geoff
"Jim Wooley" <ji************ *@hotmail.com> wrote in message
news:24******** *************** **@msnews.micro soft.com... 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.
FWIW, you can browse to the original message thread at http://groups.google.com/group/micro...0e849bc599d7fc
Jim Wooley http://devauthority.com/blogs/jwooley
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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: Gary Miller |
last post by:
Does anyone know how to detect a modeless form on closing by the form that
invoked the modeless form?
form.Show();
|
by: **Developer** |
last post by:
When I get a closing event in a MID Child form I don't know if the child
form is closing or the main form is closing.
Is there a way to tell?
Thank
|
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: Charles Law |
last post by:
Under what circumstances would e.Cancel be set to True on entry to the
Closing event of an MDI child form?
I have found that this is why my application won't close properly. I can
explicitly set the value to False, but I would have expected it to be False
on entry.
TIA
Charles
| |
by: Tom |
last post by:
How is the best way to avoid validation when closing a
window? For instance, I have a Windows Forms window which
has a validation event for a text box. However, if one
enters invalid data in then and then attempts to close the
window (either via my custom 'Close' box or by clicking the
close 'X' in the upper right window corner), the validation
event still triggers and it tells the user that they have
invalid data. Which of course means...
|
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: =?Utf-8?B?UHVjY2E=?= |
last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3
forms. I want allow users to move forward and backward with the forms and
retain the data users have entered. I thought I'll make the inactive forms
invisible but this is creating a memory corruption problem when user close
the form2 or form3 and not the formMain.
My main form has a Next button which makes the main form invisible and
starts a new form which I'll...
|
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: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= |
last post by:
I am (still) relatively new to Windows applications, most of my experience
has been Web based, and I am confused about what exactly happens when the
Main() method is called and how to manipulate forms opening & closing.
An example of this issue is as follows. I have a logon form open as the
first thing. The main functional form opens when a user has successfully
logged on. From the main form, a user should be able to logout which will...
|
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: 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: 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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |