简体   繁体   中英

Creating control events in the Visual Studio IDE when programming in C#

I have been developing VB.Net winform apps using Visual Studio for several years and I am now just trying to get my head around C#. When I am using Visual Studio (currently VS 2017) to develop VB.Net winform apps I have three dropdowns at the top of the IDE that allows me to select the project, control and then events for the selected control. So if I want to handle, for example, the MouseDown event of a TextBox I simply select the MouseDown event in the dropdown and Visual Studio creates the event handler for me.

In C#, if I double click the control in the Design view it will automatically create the event handler for the default event, but what about all of the other events? Is there a C# equivalent way to VB.Net to generate the handler automatically or do I always have to create the event handlers manually?

Thanks

Just switch to the event tab on your control property page and double-click your event and VS creates exact THIS handler for you.

可视化

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM