Hi All,
What is the fastest way to write an event handler for, let's say a form (with the right signature and all) in C#. I find myself doing the following:
1 - Use the WinCV utility to find out (by looking at the Invoke method) what the correct signature of the event is.
2 - Create a method in my class (a Windows form in this case) that matches the signature of the delegate, as shown in the WinCV utility.
3 - Manually update the InitializeComponent method to register my event handler with the event delegate.
In the old days when I used to programm in Visual Basic 6, I used to (1)double click on the control to which I wanted to add an event handler, (2)select an event from a combo box, and (3)the event handler template (with the correct signature) would be created automatically as soon as I selected the event from the combo box. All I had to do was Double-Click, Select, and write code.
In C#, I'm forced to know the signature of the event delegate before I write an event handler. If I don't know it, I'm out of luck. On top of that, I have to manually register the event in the InitializeComponent method. Is there anyway to generate the template for event handlers automatically? For example, when you double-click on a Windows form, an event handler is automatically created for the Load event of the form. Can this be done automatically for other events as well?
Thanks!
JC
Friends are angels who lift us to our feet when our wings have trouble remembering how to fly...
What is the fastest way to write an event handler for, let's say a form (with the right signature and all) in C#. I find myself doing the following:
1 - Use the WinCV utility to find out (by looking at the Invoke method) what the correct signature of the event is.
2 - Create a method in my class (a Windows form in this case) that matches the signature of the delegate, as shown in the WinCV utility.
3 - Manually update the InitializeComponent method to register my event handler with the event delegate.
In the old days when I used to programm in Visual Basic 6, I used to (1)double click on the control to which I wanted to add an event handler, (2)select an event from a combo box, and (3)the event handler template (with the correct signature) would be created automatically as soon as I selected the event from the combo box. All I had to do was Double-Click, Select, and write code.
In C#, I'm forced to know the signature of the event delegate before I write an event handler. If I don't know it, I'm out of luck. On top of that, I have to manually register the event in the InitializeComponent method. Is there anyway to generate the template for event handlers automatically? For example, when you double-click on a Windows form, an event handler is automatically created for the Load event of the form. Can this be done automatically for other events as well?
Thanks!
JC
Friends are angels who lift us to our feet when our wings have trouble remembering how to fly...