简体   繁体   中英

Double-clicking a button doesn't open its code-behind

I'm making a windows form using c# and added 3 buttons. When I double click on any object, it takes me to the code, the specific function that gets called when that object is activated, depending on its type. However, when I double click on the 2nd or 3rd buttons, it takes me to button 1's code instead of opening the function called by double clicking on the button I pressed.

Help?

That happens when all 3 buttons are assigned to the same event. Select the 2 wrong buttons and delete their event in the properties window. Now doubleclicking one of them will create a new code template for it.. You probably had the three all selected when you created the 1st event..

通过每个按钮的属性窗口删除按钮单击事件,并将它们重新分配。

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