0

I'm new to Visual Studio (2013), I usually add event handlers in the design view via the thunderbolt icon. How can I do this in the code editor using a kind of code completion? In particular for events defined in referenced DLL, that I cannot access in the design view.

EDIT For example this event handler generated via thunderbolt icon in design view:

    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
        ...
    }

How can I do the same in the code editor, selecting somehow Form1, having a list of available events and choose one of them...

rok
  • 2,574
  • 3
  • 23
  • 44
  • Just type`someObj.EventName += ` + TAB and Intellisense will create a handler for you. – Dennis Nov 11 '15 at 11:19
  • Perhaps this is what you mean: Type it in code like `ControlName.Click +=` and press tab twice. – Silvermind Nov 11 '15 at 11:19
  • No..I'd like a list of events to choose from.. – rok Nov 11 '15 at 11:23
  • Events are another type of member, so `instance.` and you should be prompted (or use the keyboard shortcut to force). Note events have their own icon in the list. – Richard Nov 11 '15 at 11:25
  • 2
    @rok: have you tried to type what was suggested? `someObj` + DOT -> select event from member list + ENTER (or TAB) + `"+= "` + TAB – Dennis Nov 11 '15 at 11:26
  • Edited my question to clarify – rok Nov 11 '15 at 11:29
  • 1
    You can't really do this in the same way; even if you bring up a choice of events from intellisense, as you can by typing even one letter in the code of a class, you still will only get the handler hookup code addded to the code file you are in. Doing it in the designer will add it where it really belong, that is in the desiger.cs file.. – TaW Nov 11 '15 at 11:37

0 Answers0