如何删除虚拟事件事件创建 [英] How to remove dummy event event creation

查看:63
本文介绍了如何删除虚拟事件事件创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用一个按钮并在其中编写代码的任何事件(例如click事件,如 private void button1_Click (object sender,EventArgs e))。但是很久以后这个按钮无效,因为它创建了虚拟事件,名称是 private void button1_Click_1 (对象发送者,EventArgs e)。如何过滤?请尽快给出解决方案。

I use a button and write codes inside it's any event (e.g. "click" event like "private void button1_Click(object sender, EventArgs e)"). But few time later this button is not working because it's create dummy event and the name is "private void button1_Click_1(object sender, EventArgs e)". How to filter it?? please give the solution as soon as possible.

推荐答案

发生的事情是你创建了一个方法,然后添加了一个Click事件处理程序,可能是双击按钮。

执行此操作:

突出显示Designer中的按钮,然后查看属性窗格。

单击选择事件 闪电螺栓按钮。

在列表中找到Click事件,然后查看处理程序方法,它是正确的 - 这将是button1_Click_1 - 如果是,删除它,因此Click在列表中没有处理程序。

现在回到代码,找到button1_Click_1方法 - 如果它仍然存在,删除它。

检查你的button1_Click方法是否仍然存在。

如果是,请返回设计器,再次查看属性盘中的Click事件。

使用右侧的下拉箭头,然后选择button1_Click 作为处理程序。
What has happened is that you have created a method, and then added a Click event handler, probably by double clicking the button.
Do this:
Highlight the button in the Designer, and look at the Properties pane.
Select "Events" by clicking on the "lightening bolt" button.
Find the "Click" event in the in list, and look at the handler method to it';s right - this will be "button1_Click_1" - if it is, delete it, so the Click has no handler in the list.
Now go back to the code, and look for the "button1_Click_1" method - if it still exists, delete it.
Check your "button1_Click" method still exists.
If it does, go back to the designer, and look at the Click event in the properties pan again.
Use the drop down arrow to the right, and select "button1_Click" as the handler.


这篇关于如何删除虚拟事件事件创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆