一些表单事件(加载,显示)停止工作 [英] Some form events (Load, Shown) stopped working

查看:129
本文介绍了一些表单事件(加载,显示)停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个表单的项目。对项目数据集进行了一些更改后,一个窗体上的Load事件停止工作(尽管表单正确显示)。表单本身没有变化。作为一个快速的解决方法,我创建了显示处理程序(通过VS IDE)并将我的代码放在那里,但它并没有触发(我创建了测试消息框,以确保它不是调试器的问题)。 >

另一方面,许多事件都可以工作,例如我已经尝试了Activated,它的工作原理,但对我来说没有用。



.Designer.cs中有适当的行:

  this.Load + = new System.EventHandler(this.FormZlecenie_Load); 

我已经比较了与此表单相连的三个文件(.cs,.resx,.Designer.cs )与我在更改数据集之前所做的备份,几乎没有任何差异(备份工作没有问题)。



我不想恢复备份,因为我需要数据集中的这些更改,并且有很多。



我也删除了所有的二进制文件夹(bin,obj),但没有成功。



我已经在网上寻找类似的问题,但唯一的解决方案发现是重新创建表单。这是我最后的手段,因为这将是相当耗时的,我不喜欢放弃这么容易。



那么我应该在哪里看?我没有想法。

解决方案

查看代码中的绑定。有时候绑定错误时会忽略事件(即绑定到Thread.IsAlive - 我的情况)。


I have a project with multiple forms. After some changes to the project dataset, Load event on one form stopped working (although form shows correctly). There were no changes to the form itself. As a quick workaround I've created Shown handler (through VS IDE) and put my code there, but it's not firing either (I've created test message boxes to be sure it isn't a problem with debugger).

On the other hand many events do work, e.g. I've tried Activated and it works but it's not useful for me.

There is appropriate line in .Designer.cs:

 this.Load += new System.EventHandler(this.FormZlecenie_Load);

I've compared three files connected with this form (.cs, .resx, .Designer.cs) with backup that I've made before changes to the dataset and there are virtually no differences (and backup works without problems).

I don't want to revert to backup because I need these changes in dataset and there are many.

I've also deleted all binary folders (bin, obj) but without success.

I've looked for similar problems on the net but the only solution I've found was to re-create the form. This is the last resort for me because it will be rather time-consuming and I don't like to give up so easily.

So where else should I look? I'm out of ideas.

解决方案

Look at the bindings in your code. Sometimes events are omit when bindings are wrong (i.e. binding to Thread.IsAlive - my case).

这篇关于一些表单事件(加载,显示)停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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