473,586 Members | 2,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2301
Put a concole.writeli ne in an eventhandler for every event for the object in
question.

"Erik Frey" <er*******@hotm ail.com> wrote in message
news:Ox******** ******@TK2MSFTN GP09.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******@sysof t.co.nz> wrote in message
news:um******** *****@tk2msftng p13.phx.gbl...
Put a concole.writeli ne in an eventhandler for every event for the object in question.

"Erik Frey" <er*******@hotm ail.com> wrote in message
news:Ox******** ******@TK2MSFTN GP09.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*******@hotm ail.com> wrote in message
news:O8******** ******@TK2MSFTN GP09.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******@sysof t.co.nz> wrote in message
news:um******** *****@tk2msftng p13.phx.gbl...
Put a concole.writeli ne in an eventhandler for every event for the object
in
question.

"Erik Frey" <er*******@hotm ail.com> wrote in message
news:Ox******** ******@TK2MSFTN GP09.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.Reflecti on.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*******@hotm ail.com> wrote in message
news:O8******** ******@TK2MSFTN GP09.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******@sysof t.co.nz> wrote in message
news:um******** *****@tk2msftng p13.phx.gbl...
Put a concole.writeli ne in an eventhandler for every event for the object
in
question.

"Erik Frey" <er*******@hotm ail.com> wrote in message
news:Ox******** ******@TK2MSFTN GP09.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.eventarg s) and just keep adding handlers to it.

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

console.writeli ne(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.EventArg s...)

How is that for 'clever'

"Erik Frey" <er*******@hotm ail.com> wrote in message
news:O8******** ******@TK2MSFTN GP09.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******@sysof t.co.nz> wrote in message
news:um******** *****@tk2msftng p13.phx.gbl...
Put a concole.writeli ne in an eventhandler for every event for the object
in
question.

"Erik Frey" <er*******@hotm ail.com> wrote in message
news:Ox******** ******@TK2MSFTN GP09.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****@blowgoa ts.com> wrote in message
news:e9******** ********@TK2MSF TNGP11.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.eventarg s) and just keep adding handlers to it.

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

console.writeli ne(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.EventArg s...)

How is that for 'clever'

"Erik Frey" <er*******@hotm ail.com> wrote in message
news:O8******** ******@TK2MSFTN GP09.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******@sysof t.co.nz> wrote in message
news:um******** *****@tk2msftng p13.phx.gbl...
Put a concole.writeli ne in an eventhandler for every event for the object
in
question.

"Erik Frey" <er*******@hotm ail.com> wrote in message
news:Ox******** ******@TK2MSFTN GP09.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********@ema il.msn.com> wrote in message
news:uy******** ********@TK2MSF TNGP11.phx.gbl. ..
Erik,
To dynamically create a method (class/Assembly) look at the
System.Reflecti on.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*******@hotm ail.com> wrote in message
news:O8******** ******@TK2MSFTN GP09.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******@sysof t.co.nz> wrote in message
news:um******** *****@tk2msftng p13.phx.gbl...
Put a concole.writeli ne in an eventhandler for every event for the object
in
question.

"Erik Frey" <er*******@hotm ail.com> wrote in message
news:Ox******** ******@TK2MSFTN GP09.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*******@hotm ail.com> wrote in message
news:eC******** ********@TK2MSF TNGP11.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********@ema il.msn.com> wrote in message news:uy******** ********@TK2MSF TNGP11.phx.gbl. ..
Erik,
To dynamically create a method (class/Assembly) look at the
System.Reflecti on.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*******@hotm ail.com> wrote in message
news:O8******** ******@TK2MSFTN GP09.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******@sysof t.co.nz> wrote in message
news:um******** *****@tk2msftng p13.phx.gbl...
> Put a concole.writeli ne in an eventhandler for every event for the

object
in
> question.
>
> "Erik Frey" <er*******@hotm ail.com> wrote in message
> news:Ox******** ******@TK2MSFTN GP09.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
4321
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 record has not changed, the db doesn’t need updating). This seems to work fine except that when the user finishes and clicks a ‘done’ button or the...
2
5917
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 pages, each of which has a link to a "print view" page. That "print view" page has a "print" button which calls a javascript function "printThis": ...
2
2911
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 this knowledge base article. ( http://support.microsoft.com/?id=319985 ) to execute a DTS package and monitor it's events. I'm not able to capture...
1
1755
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
2687
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 like: <BODY onEvent="mydebugfunction();"> In case you're wondering, what I'm trying to do is to determine what event(s) are occurring with a...
7
62039
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 does not work. How can I capture the cursor left and right keys for processing?
3
3038
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 function! Thanks
0
1678
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 WebBrowser and override its onkeyup event - didn't work. 2. Same as option 1 but override preprocessmessage - didn't work. 3. Same as option 1 but...
2
5847
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 supported by this control. (inherited from WebBrowserBase)". Does this mean that I can't access these? I am using VS Express C#. Otherwise how do I...
6
4691
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 someone could point me in the right direction. Thank you for any help.
0
7841
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7965
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...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6617
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
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...
0
5392
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...
0
3838
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...
1
2345
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 we have to send another system
0
1184
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...

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.