SirDarknight1200 Posted October 1, 2013 Share Posted October 1, 2013 #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 24, 32, 265, 21) $Input2 = GUICtrlCreateInput("Input2", 24, 80, 265, 21) $Button1 = GUICtrlCreateButton("Button1", 296, 240, 225, 73) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If $Input1 > $Input2 Then MsgBox(0,"Test", "Greater") Else MsgBox(0, "Test", "Smaller") EndIf EndSwitch WEnd What I want is if I put 2 in input1 and 1 in input2 and press the button. the msgbox will show greater. But it shows smaller everytime Link to comment Share on other sites More sharing options...
TheSaint Posted October 1, 2013 Share Posted October 1, 2013 You are just getting the ID of the Inputs. You need to read the value you set in the Inputs. Case $Button1 If GUICtrlRead($Input1) > GUICtrlRead($Input2) Then MsgBox(0,"Test", "Greater") Else MsgBox(0, "Test", "Smaller") EndIf You also aren't checking for when they are equal. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Solution TheSaint Posted October 1, 2013 Solution Share Posted October 1, 2013 All up, you would be better off assigning what you read, to variables. Case $Button1 $val_1 = GUICtrlRead($Input1) $val_2 = GUICtrlRead($Input2) If $val_1 > $val_2 Then MsgBox(0,"Test", "Greater") ElseIf $val_1 < $val_2 Then MsgBox(0,"Test", "Smaller") Else MsgBox(0, "Test", "Equal") EndIf Astormooke 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
SirDarknight1200 Posted October 1, 2013 Author Share Posted October 1, 2013 Thanks a lot Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now