What happen with my InvokedRequired?

喜欢而已 提交于 2019-12-24 23:35:41

问题


What wrong with my code ??

Why it not go to true statement ?


回答1:


Your if statement has three conditions - you're only showing two of them in the debugger.

I suspect that explains why you're seeing something odd - but I don't think your code is appropriate to start with. For one thing, you're testing the same condition twice, which is pointless (did you mean one of them to be lockScreen rather than loginScreen?) - but more importantly, if one of those InvokeRequired properties returns false, you won't be using BeginInvoke for any of the forms... even if InvokeRequired returned true for that form.

I suggest you split this up into three separate blocks, each of which checks and acts on a single form.




回答2:


the third statement in the IF is a different boolean :)



来源:https://stackoverflow.com/questions/8945829/what-happen-with-my-invokedrequired

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!