473,408 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

capture all events?

Hi there,

Just curious as to whether there's a clever way to see the events a
control/object is firing off, perhaps written out to the debug console. It
would be really handy to know which events a control is firing when I
perform a certain action, and the order in which they are occurring.

Thanks,

Erik
Nov 20 '05 #1
9 2290
Put a concole.writeline in an eventhandler for every event for the object in
question.

"Erik Frey" <er*******@hotmail.com> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
Hi there,

Just curious as to whether there's a clever way to see the events a
control/object is firing off, perhaps written out to the debug console. It would be really handy to know which events a control is firing when I
perform a certain action, and the order in which they are occurring.

Thanks,

Erik

Nov 20 '05 #2
I was wondering if there was a -clever- way of doing it, dynamic for an
object you choose.

My initial thoughts were to use reflection to loop through all the event
signatures - I imagine you can do that. And adding a handler, with some
kind of dynamically created method? Maybe? I don't even know if such a
thing is possible.

"Stephany Young" <st******@sysoft.co.nz> wrote in message
news:um*************@tk2msftngp13.phx.gbl...
Put a concole.writeline in an eventhandler for every event for the object in question.

"Erik Frey" <er*******@hotmail.com> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
Hi there,

Just curious as to whether there's a clever way to see the events a
control/object is firing off, perhaps written out to the debug console.

It
would be really handy to know which events a control is firing when I
perform a certain action, and the order in which they are occurring.

Thanks,

Erik


Nov 20 '05 #3
Sometimes you just have to get down and dirty and write some code.

"Erik Frey" <er*******@hotmail.com> wrote in message
news:O8**************@TK2MSFTNGP09.phx.gbl...
I was wondering if there was a -clever- way of doing it, dynamic for an object you choose.

My initial thoughts were to use reflection to loop through all the event signatures - I imagine you can do that. And adding a handler, with some
kind of dynamically created method? Maybe? I don't even know if such a
thing is possible.

"Stephany Young" <st******@sysoft.co.nz> wrote in message
news:um*************@tk2msftngp13.phx.gbl...
Put a concole.writeline in an eventhandler for every event for the object
in
question.

"Erik Frey" <er*******@hotmail.com> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
Hi there,

Just curious as to whether there's a clever way to see the events a control/object is firing off, perhaps written out to the debug

console. It
would be really handy to know which events a control is firing when I
perform a certain action, and the order in which they are occurring.

Thanks,

Erik



Nov 20 '05 #4
Cor
Stephany
I love that answer, did not look at the question :-)
Cor
Nov 20 '05 #5
Erik,
To dynamically create a method (class/Assembly) look at the
System.Reflection.Emit namespace. Word of advice, load the dynamic assembly
into a new AppDomain so you can unload it.

Alternatively you could use System.CodeDom to create a source module that
you later compile.

In either case you probably could have written a single module faster and
manually handle all the events! However! You would not have a cool utility
worth sharing, that would handle events out of any source. Of course if you
are going the cool utility route, be sure we can choose which events we want
handled! And post the utility on www.gotdotnet.com or someplace were the
rest of us can use it!

BTW: Dynamically handling events I think would be handy for utilities such
as www.nunit.org & www.csunit.org. Have an attribute that says this method
should raise this event. The tool would dynamically handle the event to be
certain it was raised. Similar to how they handles Exceptions.

Hope this helps
Jay

"Erik Frey" <er*******@hotmail.com> wrote in message
news:O8**************@TK2MSFTNGP09.phx.gbl...
I was wondering if there was a -clever- way of doing it, dynamic for an object you choose.

My initial thoughts were to use reflection to loop through all the event signatures - I imagine you can do that. And adding a handler, with some
kind of dynamically created method? Maybe? I don't even know if such a
thing is possible.

"Stephany Young" <st******@sysoft.co.nz> wrote in message
news:um*************@tk2msftngp13.phx.gbl...
Put a concole.writeline in an eventhandler for every event for the object
in
question.

"Erik Frey" <er*******@hotmail.com> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
Hi there,

Just curious as to whether there's a clever way to see the events a control/object is firing off, perhaps written out to the debug

console. It
would be really handy to know which events a control is firing when I
perform a certain action, and the order in which they are occurring.

Thanks,

Erik



Nov 20 '05 #6
You could also look into bubble eventing. basically have everything point
to a sub that has the signiture (sp?) of (sender as object, e as
system.eventargs) and just keep adding handlers to it.

Then when you call the event handler (as an event is fired) you could do

console.writeline(e.gettype().tostring()) which will tell you what kind of
event argument handler your dealing with. and from there, you can pretty
much do what you want, since most event handlers have like signitures (and
are almost all derived from System.EventArgs...)

How is that for 'clever'

"Erik Frey" <er*******@hotmail.com> wrote in message
news:O8**************@TK2MSFTNGP09.phx.gbl...
I was wondering if there was a -clever- way of doing it, dynamic for an object you choose.

My initial thoughts were to use reflection to loop through all the event signatures - I imagine you can do that. And adding a handler, with some
kind of dynamically created method? Maybe? I don't even know if such a
thing is possible.

"Stephany Young" <st******@sysoft.co.nz> wrote in message
news:um*************@tk2msftngp13.phx.gbl...
Put a concole.writeline in an eventhandler for every event for the object
in
question.

"Erik Frey" <er*******@hotmail.com> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
Hi there,

Just curious as to whether there's a clever way to see the events a control/object is firing off, perhaps written out to the debug

console. It
would be really handy to know which events a control is firing when I
perform a certain action, and the order in which they are occurring.

Thanks,

Erik



Nov 20 '05 #7
Thanks for the advice:

http://www.codeproject.com/csharp/controlinspector.asp

"CJ Taylor" <no****@blowgoats.com> wrote in message
news:e9****************@TK2MSFTNGP11.phx.gbl...
You could also look into bubble eventing. basically have everything point
to a sub that has the signiture (sp?) of (sender as object, e as
system.eventargs) and just keep adding handlers to it.

Then when you call the event handler (as an event is fired) you could do

console.writeline(e.gettype().tostring()) which will tell you what kind of
event argument handler your dealing with. and from there, you can pretty
much do what you want, since most event handlers have like signitures (and
are almost all derived from System.EventArgs...)

How is that for 'clever'

"Erik Frey" <er*******@hotmail.com> wrote in message
news:O8**************@TK2MSFTNGP09.phx.gbl...
I was wondering if there was a -clever- way of doing it, dynamic for an
object you choose.

My initial thoughts were to use reflection to loop through all the

event
signatures - I imagine you can do that. And adding a handler, with some
kind of dynamically created method? Maybe? I don't even know if such a
thing is possible.

"Stephany Young" <st******@sysoft.co.nz> wrote in message
news:um*************@tk2msftngp13.phx.gbl...
Put a concole.writeline in an eventhandler for every event for the object
in
question.

"Erik Frey" <er*******@hotmail.com> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
> Hi there,
>
> Just curious as to whether there's a clever way to see the events a > control/object is firing off, perhaps written out to the debug console. It
> would be really handy to know which events a control is firing when

I > perform a certain action, and the order in which they are occurring.
>
> Thanks,
>
> Erik
>
>



Nov 20 '05 #8
Thanks for the advice - it looks like you were on the right track.
Someone pointed me to this:

http://www.codeproject.com/csharp/controlinspector.asp

It basically does what you describe. Pretty handy utility!

Erik

"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:uy****************@TK2MSFTNGP11.phx.gbl...
Erik,
To dynamically create a method (class/Assembly) look at the
System.Reflection.Emit namespace. Word of advice, load the dynamic assembly into a new AppDomain so you can unload it.

Alternatively you could use System.CodeDom to create a source module that
you later compile.

In either case you probably could have written a single module faster and
manually handle all the events! However! You would not have a cool utility
worth sharing, that would handle events out of any source. Of course if you are going the cool utility route, be sure we can choose which events we want handled! And post the utility on www.gotdotnet.com or someplace were the
rest of us can use it!

BTW: Dynamically handling events I think would be handy for utilities such
as www.nunit.org & www.csunit.org. Have an attribute that says this method
should raise this event. The tool would dynamically handle the event to be
certain it was raised. Similar to how they handles Exceptions.

Hope this helps
Jay

"Erik Frey" <er*******@hotmail.com> wrote in message
news:O8**************@TK2MSFTNGP09.phx.gbl...
I was wondering if there was a -clever- way of doing it, dynamic for an
object you choose.

My initial thoughts were to use reflection to loop through all the

event
signatures - I imagine you can do that. And adding a handler, with some
kind of dynamically created method? Maybe? I don't even know if such a
thing is possible.

"Stephany Young" <st******@sysoft.co.nz> wrote in message
news:um*************@tk2msftngp13.phx.gbl...
Put a concole.writeline in an eventhandler for every event for the object
in
question.

"Erik Frey" <er*******@hotmail.com> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
> Hi there,
>
> Just curious as to whether there's a clever way to see the events a > control/object is firing off, perhaps written out to the debug console. It
> would be really handy to know which events a control is firing when

I > perform a certain action, and the order in which they are occurring.
>
> Thanks,
>
> Erik
>
>



Nov 20 '05 #9
Erik,
Thanks for the link! I'll need to look at that later.

Jay

"Erik Frey" <er*******@hotmail.com> wrote in message
news:eC****************@TK2MSFTNGP11.phx.gbl...
Thanks for the advice - it looks like you were on the right track.
Someone pointed me to this:

http://www.codeproject.com/csharp/controlinspector.asp

It basically does what you describe. Pretty handy utility!

Erik

"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message news:uy****************@TK2MSFTNGP11.phx.gbl...
Erik,
To dynamically create a method (class/Assembly) look at the
System.Reflection.Emit namespace. Word of advice, load the dynamic assembly
into a new AppDomain so you can unload it.

Alternatively you could use System.CodeDom to create a source module that
you later compile.

In either case you probably could have written a single module faster and manually handle all the events! However! You would not have a cool utility worth sharing, that would handle events out of any source. Of course if

you
are going the cool utility route, be sure we can choose which events we

want
handled! And post the utility on www.gotdotnet.com or someplace were the
rest of us can use it!

BTW: Dynamically handling events I think would be handy for utilities such as www.nunit.org & www.csunit.org. Have an attribute that says this method should raise this event. The tool would dynamically handle the event to be certain it was raised. Similar to how they handles Exceptions.

Hope this helps
Jay

"Erik Frey" <er*******@hotmail.com> wrote in message
news:O8**************@TK2MSFTNGP09.phx.gbl...
I was wondering if there was a -clever- way of doing it, dynamic for
an
object you choose.

My initial thoughts were to use reflection to loop through all the

event
signatures - I imagine you can do that. And adding a handler, with

some kind of dynamically created method? Maybe? I don't even know if such a thing is possible.

"Stephany Young" <st******@sysoft.co.nz> wrote in message
news:um*************@tk2msftngp13.phx.gbl...
> Put a concole.writeline in an eventhandler for every event for the

object
in
> question.
>
> "Erik Frey" <er*******@hotmail.com> wrote in message
> news:Ox**************@TK2MSFTNGP09.phx.gbl...
> > Hi there,
> >
> > Just curious as to whether there's a clever way to see the

events
a
> > control/object is firing off, perhaps written out to the debug

console.
> It
> > would be really handy to know which events a control is firing when I > > perform a certain action, and the order in which they are

occurring. > >
> > Thanks,
> >
> > Erik
> >
> >
>
>



Nov 20 '05 #10

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

Similar topics

2
by: William Gill | last post by:
I am trying to make a simple data editor in Tkinter where each data element has a corresponding Entry widget. I have tried to use the FocusIn/FocusOut events to set a 'hasChanged' flag (if a...
2
by: aimee | last post by:
Hi. Is there a way to capture the events fired in a PrintDialog? I would like to capture when the user presses "Print" so I can do some cleanup. The asp.net (IE6) application I'm working on has 6...
2
by: Rich Tasker | last post by:
My goal is to execute a DTS package that calls multiple child DTS packages from a C# (2003) app and display the progress of the entire process to the user. I have followed the model defined in...
1
by: Dave | last post by:
Hi, How can i capture the mouse move event of my window form when i move it ebove other control? Thanks!
2
by: ohaya | last post by:
Hi, I'm trying to debug a problem with a page, and I was wondering if there was any way to capture all events within a BODY? I don't know if this is possible, but I was thinking of something...
7
by: Bob Achgill | last post by:
When I use the code for KeyPress to capture pressing a certain key for processing on a form with no Text Box it works. But when I try the same code on my application that has text boxes it does...
3
by: Dave | last post by:
Hi, I have a control on my vb app form that dont cath a mouse event`s how can i catch a mouse event on that control and pass it to a function in my main form??? In VB-6 i used the setcapture api...
0
by: Vin | last post by:
The .Net 2.0's webbrowser is neat and pretty. But I am not able to capture Key events when the focus is on the webbrowser control in my winform. Options tried. 1. Wrote a class which extends this...
2
by: =?Utf-8?B?c25naWxi?= | last post by:
The WebBrowser control is described as exposing numerous public mouse events. See: http://msdn2.microsoft.com/en-us/library/ayestehw.aspx. many of the event are described as: "This event is not...
6
by: jmDesktop | last post by:
I have a writing/sketch tablet attached to a PC and want to capture the signature with c#. I am not using a tablet pc or a pda, but a regular computer. I am using 2.0 framework. Was hoping...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
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...

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.