José received a bit of VB .Net UI code that left him scratching his head.
While IsNothing(Me.FfrmWait)
If Not IsNothing(Me.FfrmWait) Then
Exit While
End If
End While
While a form doesn't exist, if the form does exist, break out of the loop. I suspect this was intended as a busy loop, waiting for some UI element to be ready. Because busy loops are always the best way to wait for things.
But even with the busy loop, the If
is a puzzle- why break out of the loop early, when the loop condition is going to break itself? Did they just not understand how loops work?
Now, the last thing to note is the variable naming conventions. frmMyForm
is a common convention in WinForms programming, a little bit of Hungarian notation to tell you what the UI element actually is. But what's that *leading F
there? Are they… doing a double Hungarian? Does it tell us that this is a form? Or maybe they're trying to tell us that it's a field of the class? Or maybe a developer was saying "F my life"?
We'd all be better off if this code were nothing.