3

Many times the signature of a control's event handler isn't obvious. Currently, in order to generate an event handler stub in the code behind I have to

  1. Leave Source view and enter Design view (and wait for the UI to be generated)
  2. Click on the control in question (which sometimes isn't obvious)
  3. Open the Properties toolbar
  4. Click on the lightning bolt
  5. Double-click on the event for which I want to generate a stub

Is there an easier way to do this while still in Source view?

3
  • I'm not sure I understand what you're asking. Are you wanting us to tell you how to make VS2012 read your mind to understand which control you're wanting to generate an event for and which event it is you want to handle for that control? Commented Sep 15, 2013 at 4:32
  • 2
    Well, inasmuch as intellisense reads your mind I guess. If I were to declaratively add the OnClick="butSubmit_Click" property to a button control, I think the editor would then know which event I want to generate and for which control. Seems like at that point there could be an automated way to generate the event stub in the code-behind (maybe the button is a bad example because the signature is simple). I know in VB you can use the dropdowns at the top of the page in the code-behind to generate event stubs for any controls so it seems like this should be possible in C#. Commented Sep 16, 2013 at 13:20
  • Found this question which hints 3rd Party plug-in was required to accomplish this in Visual Studio 2008. Commented Sep 16, 2013 at 18:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.