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???

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..

WTF....!?!?

Member Avatar for iamthwee

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

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:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.