I have an if sentence in my vb.net windows form

'If StrComp(WindowState.ToString, FormWindowState.Minimized.ToString) = 0 Then
If Me.WindowState <> System.Windows.Forms.FormWindowState.Normal Then
'[Object].ReferenceEquals(WindowState, FormWindowState.Minimized) Then 
' System.Windows.Forms.FormWindowState.Minimized Then  ' FormWindowState.Minimized Then

The evaluation, as you can se I have tried in different ways, evaluates to true even it should be false. The value is normal and it shows me while debugging or printed out in a msgbox. What I want it to do is having it to go into the if-condition when the value is minimized. My simplest surgestion was "IF (me.WindowState = System.Windows.Forms.FormWindowState.Minimized ) Then" but this does not work. What am I missing???

8 Years
Discussion Span
Last Post by sniper1983

Very interesting.. No matter what I feed to the if it gets into the then If I say:
dim mBool as boolean = true
if mBool Then

it gets into it. If I say

dim mBool as boolean = false
if mBool Then

it gets into it..



Shouldn't you be saying something like: if mBool = true Then as opposed to: if mBool Then

Same same..

But I found the problem/issue. The compiler debugs into the Then but does not do the actions. Two same if sentences and it will enter the last one (but not do anything in it, just steps through). A compiler-error of some kind while debugging..

Well, problem/issue solved.. Thanks for reading along.. :)

Have a lovely evening:)

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.