Is it possible to easily write an event handler in VBNET, which will activate every occurrence? I am thinking that someone can create a logging system using someone like this.
I want to do something (in pseudocode):
Public Sub Event Handel Event (ByVal as the object, as ByVal e EventArgs) File.Write ( Sender.EventName) End Sub I know it can be slow, but it will not be for a production system, as a development tool.
You can do this. Such as Create a form with a text box named TextBox1 . Paste the code below and run the project and look at the immediate window.
Public class form 1 personal sub form 1_activated (object as the vleyay sender, e-agent avent ARGS as the system) handles me. Debug active registeral events (Textbox 1, "MyAventHandler") and all Sub MyEventHandler (as an object-by-sender, Event A's event ARGS). Farewell ("An incident has been removed: sender =" and sender.Toasting and A, E = "and E. toastering) and all Sub-registerual events (by object, by object, by-name method string) 'list reflecting medium From all events' to each Ei System.Reflection.EventInfo (for obj.GetType form). GetEvents () Dim handlerType type = ei.EventHandlerType as the retype method System.Reflection.MethodInfo = Me.GetType () Copy indicating gatemath (method name) method 'Create Fund' as the Dem Handler [Representative] = [Rep.] Cutlet Delaygate (Handler Type, Me, Method) 'Register Event Through Reflection' e.AddEventHandler (obj, handler) Next End Sub End Class < / Code> It is from Franco that Balen's book technique works from any object that increases events, not just controls it. It uses.
If You have complete details and some other code that will allow you to identify In which event the use of regular expressions to have been removed in universal handler, and controls a subset of the only events. I do not think I can post such a long stretch.
Comments
Post a Comment