Jump to content

ControlGetText and number comparison


Recommended Posts

Hi I am stuck. I am using ControlGetText to define a variable and then discover which of two values is the smallest and then use this as the maximum value parameter for a randomnly generated number.

DIM $wpfalen=0, $wpfawid=0

$wpfalen=ControlGetText("Pattern", "", "Static30")
$wpfawid=ControlGetText("Pattern", "", "Static32")
                

MsgBox(0, "What has been read from statics", "1st-"&$wpfalen&"-"&$wpfawid&"-")
                
                
If $wpfalen >= $wpfawid then
                    
    $wpmax = $wpfawid
                    
    MsgBox(0, "What is $wpmax", "1st route-"&$wpmax&"-" )
                
Else
                    
    $wpmax = $wpfalen
                    
    MsgBox(0, "What is $wpmax", "2nd route-"&$wpmax&"-" )
                
EndIf

But the problem I am having is that occasionally the >= statement is being evaluated incorrectly.

Do I need to convert the text from the statics to a number? If so how?

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...