Default Event Handler in VS.NET IDE Forms Designer
-
You know how when you double-click on a control in the Visual Studio.NET Windows Forms Designer, it will take you to the code and generate an event handler for you, and bind the event up in the "generated code" region? Well my questions are: 1) How does it decide WHICH event to bind to? It seems like it picks the most commonly used one, but it also seems pretty arbitrary to me. 2) Is there any way to change this default behavior, for example to make a different event the default? 3) Is there any way to auto-generate handlers and bindings for other events besides the default one, sort of like you could do in VB? It's kind of a time-consuming pain to always have to go look up the event handler arguments and which delegate you're supposed to use every time. Thanks in advance Ron Scott
-
You know how when you double-click on a control in the Visual Studio.NET Windows Forms Designer, it will take you to the code and generate an event handler for you, and bind the event up in the "generated code" region? Well my questions are: 1) How does it decide WHICH event to bind to? It seems like it picks the most commonly used one, but it also seems pretty arbitrary to me. 2) Is there any way to change this default behavior, for example to make a different event the default? 3) Is there any way to auto-generate handlers and bindings for other events besides the default one, sort of like you could do in VB? It's kind of a time-consuming pain to always have to go look up the event handler arguments and which delegate you're supposed to use every time. Thanks in advance Ron Scott
Hi! 1) DefaultEventAttribute attributes used by IDE for detecting what to do on click. 2) use DefaultEvent attribute in class declaration to make custom event a default for click 3) you can use CodeTemplate Addon for .NET IDE for more details about attribute please look into MSDN or www.dotnet247.com site Good Luck Alex Kucherenko
-
Hi! 1) DefaultEventAttribute attributes used by IDE for detecting what to do on click. 2) use DefaultEvent attribute in class declaration to make custom event a default for click 3) you can use CodeTemplate Addon for .NET IDE for more details about attribute please look into MSDN or www.dotnet247.com site Good Luck Alex Kucherenko
Thanks for your reply, I'll look into that stuff!