Microsoft Visual Studio and C#: How to Visually Add Events to Controls?

后端 未结 2 1872
北恋
北恋 2020-11-29 12:14

How would one go about adding an event handler to a control in a form in Microsoft Visual Studio (2008) with C#?

I can do it manually, but opening the Designer.cs fil

2条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 12:47

    In the designer, click the control of interest.

    In the properties window (hit F4 to bring it up), there should be a little lightning bolt icon. Clicking the icon takes you to the list of available events for that control. Double-clicking the event name will wire up a stub handler and take you to the code-behind for it.

    alt text

    Edit: the astute reader will see that the posted screenshot is for a web app (whups), but it's the exact same thing for a winforms app.

提交回复
热议问题