请问C#有一个把手的关键字?有一个、把手、关键字

2023-09-04 11:48:39 作者:放下尊严放下个性放下固执

Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick


End Sub

在VB.net,我们有Handles关键字,我想知道如果C#有什么可比性。还是你必须手动关联的所有方法给每个控件的事件(在ASP.NET尤其是)?

In VB.net, we have the Handles keyword, I'm wondering if C# has anything comparable. Or do you have to manually wire all the methods to each control's event (in ASP.NET especially)?

推荐答案

都能跟得上。你必须要连接这样的事件

Nope. You will have to wire up the event like this

Menu1.MenuItemClick += Menu1_MenuItemClick;
 
精彩推荐
图片推荐