943,783 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1810
  • VB.NET RSS
Sep 1st, 2008
0

Me.WindowState evaluates wrong

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

VB.NET Syntax (Toggle Plain Text)
  1. 'If StrComp(WindowState.ToString, FormWindowState.Minimized.ToString) = 0 Then
  2. If Me.WindowState <> System.Windows.Forms.FormWindowState.Normal Then
  3. '[Object].ReferenceEquals(WindowState, FormWindowState.Minimized) Then
  4. ' System.Windows.Forms.FormWindowState.Minimized Then ' FormWindowState.Minimized Then
  5. ...

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???
Reputation Points: 10
Solved Threads: 0
Light Poster
sniper1983 is offline Offline
30 posts
since Nov 2007
Sep 2nd, 2008
0

Re: Me.WindowState evaluates wrong

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....!?!?
Reputation Points: 10
Solved Threads: 0
Light Poster
sniper1983 is offline Offline
30 posts
since Nov 2007
Sep 2nd, 2008
0

Re: Me.WindowState evaluates wrong

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

if mBool Then
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Sep 2nd, 2008
0

Re: Me.WindowState evaluates wrong

Click to Expand / Collapse  Quote originally posted by iamthwee ...
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
Reputation Points: 10
Solved Threads: 0
Light Poster
sniper1983 is offline Offline
30 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: About VB.NET
Next Thread in VB.NET Forum Timeline: VB.NET which language





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC