473,846 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to tell if an event is being consumed?

I have an inherited datagrid which has a "double-click" even which returns
the row that has been clicked on - this can be consumed by the form (etc)
that hosts the control to open another window that shows more detailed
information on that line.

I want to be able to change the mouse pointer when the user hovers over the
control, to make it clearer that the rows can be clicked on.... However, I
only want to change the pointer if I know that the host form is actually
picking up the double-click event.

So, the question is - how can I tell if a form has a handler for a
particular event on a control from within the control itself???

Many thanks in advance
Simon
Nov 21 '05 #1
5 1333

"Simon Verona" <ne**@aphrodite uk.com> wrote
So, the question is - how can I tell if a form has a handler for a
particular event on a control from within the control itself???


Find where that event is inherited from, and see if your desired target
also inherits from that same class?

For more info see Control.DoubleC lick in VS help....

LFS
Nov 21 '05 #2
Larry,

I'm not sure I understand you....

or perhaps I've not made myself clear...

just to make sure I'll explain my problem in a different way..

I have a usercontrol that raises an event under certain circumstances..

I'd like the usercontrol to be aware if the form that hosts the control has
any code responding to the event when it is raised....

Does this help?

Regards
Simon
"Larry Serflaten" <se*******@usin ternet.com> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...

"Simon Verona" <ne**@aphrodite uk.com> wrote
So, the question is - how can I tell if a form has a handler for a
particular event on a control from within the control itself???


Find where that event is inherited from, and see if your desired target
also inherits from that same class?

For more info see Control.DoubleC lick in VS help....

LFS

Nov 21 '05 #3

You can check if the event is nothing...
Public Event SomeEvent(ByVal sender As Object, ByVal e As EventArgs)

....

If Me.SomeEvent Is Nothing Then
.. I'm being consumed ..
Else
.. Not Consumed ..
End If
HTH,

Sam

Nov 21 '05 #4

"Samuel R. Neff" <bl****@newsgro up.nospam> wrote in message
news:5a******** *************** *********@4ax.c om...

You can check if the event is nothing...
Public Event SomeEvent(ByVal sender As Object, ByVal e As EventArgs)

...

If Me.SomeEvent Is Nothing Then
.. I'm being consumed ..
Else
.. Not Consumed ..
End If
HTH,

Sam

Ok, I tried this...

In my control (which is inherited from a third party datagrid), I have an
event created with the following signature:

Public Event RowSelected(ByV al RowNo As Int32)

I'm trying to create the following code within the MouseEnter event within
the control so that if the form handles the RowSelected event the mouse
pointer changes to a hand as it moves into the control:

Private Sub DmsReport_Mouse Enter(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.MouseEnt er

If Me.RowSelected Is Nothing Then

Cursor.Current = Cursors.Hand

End If

End Sub

This won't compile as it says that "rowselecte d is an event and cannot be
called directly, use raiseevent"...

I think I have misunderstood the solution!

Regards

Simon
Nov 21 '05 #5

Sorry, I mistyped the example. "Event" was not supposed to be part of
the event name, but is supposed to be part of the event inspection
call.

Use this:
Public Event RowSelected(ByV al RowNo As Int32)

Private Sub DmsReport_Mouse Enter(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.MouseEnt er

If Me.RowSelectedE vent Is Nothing Then

Cursor.Current = Cursors.Hand

End If
One thing to note is that even if the event is declared as public, the
"Event" property which you can use to inspect the event is always
private.

HTH,

Sam


In my control (which is inherited from a third party datagrid), I have an
event created with the following signature:

Public Event RowSelected(ByV al RowNo As Int32)

I'm trying to create the following code within the MouseEnter event within
the control so that if the form handles the RowSelected event the mouse
pointer changes to a hand as it moves into the control:

Private Sub DmsReport_Mouse Enter(ByVal sender As Object, ByVal e As
System.EventAr gs) Handles MyBase.MouseEnt er

If Me.RowSelected Is Nothing Then

Cursor.Curre nt = Cursors.Hand

End If

End Sub

This won't compile as it says that "rowselecte d is an event and cannot be
called directly, use raiseevent"...

I think I have misunderstood the solution!

Regards

Simon


Nov 21 '05 #6

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

Similar topics

303
17876
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b. Yahoo store was originally written in Lisp. c. Emacs The issues with these will probably come up, so I might as well mention them myself (which will also make this a more balanced
3
10410
by: John Baro | last post by:
I need to implement an event to notify when a property has changed. Method 1. If I use a generic PropertyChanged event from System.ComponentModel then it will be raised for every property if 1 or more properties changed events are consumed. (more overhead, less coding) i.e PropertyChanged(object sender, PropertyChangedEventArgs e); Method 2.
6
1767
by: Steve B. | last post by:
Is it good programming practice to call an event within an event? I'm I creating recursion somehow somewhere? Does an event (e.g. send, e) ever end? I'm sorry, I'm not sure I know what I mean, however, I do know what ever it is I should be aware of it. currentcell_event(..) { ..
8
1363
by: Pete | last post by:
Assume I have an n by n matrix of identical objects, each of which can both invoke and consume event A. If, say, obect invokes the event, the only other objects that need to consume it are those in row 1 and those in column 2. Sending the notification to other objects would be a waste of CPU. Is there an "approved" / efficient way to cause only those objects in row 1 and column 2 to receive the event notification? I've looked but just...
2
1535
by: weboweb | last post by:
Hail the experts!!! I'm creating a web user control which displays a hierarchical tree of items from an xml string passed to the control (from the host page) through an exposed property. This xml gets created in the Page_Load method of the host page Each tree item displayed by the control is a LinkButton object. This LinkButton fires a CommandEventHandler event (when the user
2
2424
by: Sin Jeong-hun | last post by:
Suppose that there is a class I've created, named MyClass. I defined an event MyEvent by public event EventHandler MyEvent; then I fire the event somewhere in the class like this this.MyEvent(sender,args); <----(1) It works fine as long as the event is consumed like this MyClass aClass = new MyClass(); aClass.MyEvent+=new EventHandler(....); <---(2)
8
3932
by: Radu | last post by:
Hi. I have an ASP control on my page: <asp:Calendar ID="calStart" ................ Etc </asp:Calendar> and I have a Custom Validator defined as <asp:CustomValidator
8
2988
by: Brad Walton | last post by:
Hello. First post, but been doing a bit of reading here. I am working on a project in Java, but decided to switch over to C# after seeing some of the additional features I can get from C#. One of the big changes I want to make is event-driven code (rather than the linear flow I had in Java). I have spent a week or so searching Google, talking to a couple of programming friends, and just chewing on it in my brain. I think I have an ok handle...
0
9879
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, 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...
0
10643
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 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...
1
10705
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,...
1
7879
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 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...
0
7050
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();...
0
5716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5907
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4113
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3158
bsmnconsultancy
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...

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.