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.
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 thanloginScreen
?) - but more importantly, if one of thoseInvokeRequired
properties returns false, you won't be usingBeginInvoke
for any of the forms... even ifInvokeRequired
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.
the third statement in the IF is a different boolean :)