Me.WindowState evaluates wrong

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2007
Posts: 28
Reputation: sniper1983 is an unknown quantity at this point 
Solved Threads: 0
sniper1983 sniper1983 is offline Offline
Light Poster

Me.WindowState evaluates wrong

 
0
  #1
Sep 1st, 2008
I have an if sentence in my vb.net windows form

  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???
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 28
Reputation: sniper1983 is an unknown quantity at this point 
Solved Threads: 0
sniper1983 sniper1983 is offline Offline
Light Poster

Re: Me.WindowState evaluates wrong

 
0
  #2
Sep 2nd, 2008
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....!?!?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Me.WindowState evaluates wrong

 
0
  #3
Sep 2nd, 2008
Shouldn't you be saying something like:
if mBool = true Then as opposed to:

if mBool Then
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 28
Reputation: sniper1983 is an unknown quantity at this point 
Solved Threads: 0
sniper1983 sniper1983 is offline Offline
Light Poster

Re: Me.WindowState evaluates wrong

 
0
  #4
Sep 2nd, 2008
Originally Posted by iamthwee View Post
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC