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

Home Posts Topics Members FAQ

Creating Events similar to Form.Closing

Hi there,

I was just curious if anyone knew how to create a .Net event that is
similar to Form.Closing event, where in I can set the Cancel property of the
event argument to true and it will cancel the processing of the event.

Any sugessition will be appreciated.

Thanks
Nov 15 '05 #1
2 1350
make one of the event args boolean and pass it byref...raise the event
passing a local variable...do what you need to based on the value of your
local variable after raising the event.

public event aboutToDoSomthing(byref goAheadAndDoIt as boolean)

private sub prepareToDoSomething()
dim doIt as booleand
raiseevent aboutToDoSomething(doIt)
if not doIt then return
' guess they really wanna do it
end sub

hth,

steve
"news.microsoft.com" <ab*@abc.com> wrote in message
news:un**************@tk2msftngp13.phx.gbl...
| Hi there,
|
| I was just curious if anyone knew how to create a .Net event that is
| similar to Form.Closing event, where in I can set the Cancel property of
the
| event argument to true and it will cancel the processing of the event.
|
| Any sugessition will be appreciated.
|
| Thanks
|
|
Nov 15 '05 #2
Hi News,

The question's a bit vague at the moment.

What would be triggering the event? What would the event handler do and
what would it not do if it were cancelled?

For example, you can raise an event in any class and have a Cancel field
in a custom EventArgs. Anyone hooked into your event can set this so that when
it returns to your class you can take or avoid certain actions.

Is this what you have in mind? Is there something more specific? Would you
just like to know more about how events work?

Regards,
Fergus
Nov 15 '05 #3

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

Similar topics

1
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...
2
by: Ben | last post by:
My current project requires me to create part of a form that is created on the fly. The project consists a list of entries to an event. The name and address and such is easy. The design is detup so...
2
by: superseed | last post by:
Hi, I'm pretty new to C#, and I'm quite stuck on the following problem. I would like to add to my application a Windows.Form (singleton) on which I could display a message of one of the...
4
by: news.microsoft.com | last post by:
Hi there, I was just curious if anyone knew how to create a .Net event that is similar to Form.Closing event, where in I can set the Cancel property of the event argument to true and it will...
4
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...
2
by: dchman | last post by:
I have a C# app in VS2005. the form has a datetime picker with valuechanged event. When the form closes, the valuechanged event is fired and an error is thrown in its code when it tries to get a...
16
by: Al Santino | last post by:
Hi, It appears displaying a messagebox in a validating event will cancel the subsequent event. In the program below, button 2's click event doesn't fire if you open a dialog box in button 1's...
0
by: BigAl.NZ | last post by:
Hi Guys, I am trying to write/copy some code that uses events with a GPS. Everytime the GPS position updates the event fires. The GPS code is from a SDK Library that I got called GPS Tools...
1
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the...
0
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...
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...
1
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...
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
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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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 ...
0
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.