473,473 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Prevent form from closing

i want to prevent a form from closing..

to do this i want to handle the formClosing or FormClosed events.
from here i want to prevent the form from closing.

New instance of same form should not be used.

is there any way to do this?

is it posiible to do the same thing with anycode?

[i posted the same thing in VB. sorry if u find that too... reply in
one post is enough]

Jun 14 '07 #1
3 13028
On Wed, 13 Jun 2007 18:57:15 -0700, sravan_reddy001
<sr*************@gmail.comwrote:
i want to prevent a form from closing..
http://groups.google.com/groups/sear...=Search+Groups
[...]
[i posted the same thing in VB. sorry if u find that too... reply in
one post is enough]
Please learn to cross-post properly, by including all newsgroups in
Newsgroups: field of the same post, instead of multi-posting.

Pete
Jun 14 '07 #2
On 14 Jun., 03:57, sravan_reddy001 <sravanganta2...@gmail.comwrote:
i want to prevent a form from closing..

to do this i want to handle the formClosing or FormClosed events.
from here i want to prevent the form from closing.

New instance of same form should not be used.

is there any way to do this?

is it posiible to do the same thing with anycode?

[i posted the same thing in VB. sorry if u find that too... reply in
one post is enough]
Setting e.Cancel to true in the FormClosing-event should do the trick.

hth,
Kevin Wienhold

Jun 14 '07 #3
Hi,

"KWienhold" <he******@trashmail.netwrote in message
news:11*********************@i13g2000prf.googlegro ups.com...
On 14 Jun., 03:57, sravan_reddy001 <sravanganta2...@gmail.comwrote:
>i want to prevent a form from closing..

to do this i want to handle the formClosing or FormClosed events.
from here i want to prevent the form from closing.
>
Setting e.Cancel to true in the FormClosing-event should do the trick.
You need something else, you need a flag to know when the form is closing
from the code or is the user trying to close it.

bool canClose = false;

void form_Closing(.... )
{
e.Cancel = !canClose;
}

so if you want to close the form you do:

canClose =true;
Close();
Jun 14 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Miguelito Bain | last post by:
hi everybody- i have a form with 2 fields on it that i want the user to fill out before he or she can save the record, close the record, or move to the next record, etc... here's the code i...
22
by: alecjames1 | last post by:
I have a form which the user must complete before closing. I have disabled the window x button and use my own exit button. When selected it checks to see if the user has completed the entries...
7
by: Nikki | last post by:
Hi, Can anybody help me, i want to prevent windows to close my winform of ..NET application, when user presses Alt+F4
4
by: Daniel Walzenbach | last post by:
Hi, does anybody know the JavaScript the guys at Microsoft used in MS CRM to prevent people from closing a browser window and asking them (on the client) what they really want to do? If you...
9
by: Daniel Walzenbach | last post by:
Hi I am faced with the following problem: I have a page (let’s call this page page1.aspx) containing some TextBoxes and a hyperlink which opens another page (let’s call this page page2.aspx)...
2
by: Snuyt | last post by:
Hallo, when a form is closed by clicking the closing button (cross in the right upper corner of the form), it is also disposed. Can I prevent this, and instead of closing (and disposing) the...
2
by: kevininstructor | last post by:
I want to prevent a user from closing an application while doing critical operations. The following code (concept came from MSDN) works except for when the user attempts to terminate via "Task...
4
by: tlyczko | last post by:
I have been looking on the NGs and I found this code to show if a subform has no records. I have this code in the MAIN form OnClose event: Private Sub btnClose_Click() '4/16/06 new code that...
7
by: Michiel Rapati-Kekkonen | last post by:
Hi, I would like my record to be saved only when my own close button (with all it's checks) is used. I made the winodws close button disappear, but you still can close using the right mouse...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...
1
isladogs
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...
0
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...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.