nekokk Posted June 30, 2005 Share Posted June 30, 2005 (edited) $quan = inputbox("test","I need an integer",""," M") ;and then I typed a word "5" If IsInt($quan) then MsgBox(0,"test","It's a Integer","") endif ;The MsgBox never come out...... Did I use it with wrong way? I would like to know what type the data returned from MsgBox is. Please help me. Thank you in advance. Edited June 30, 2005 by nekokk Link to comment Share on other sites More sharing options...
buzz44 Posted June 30, 2005 Share Posted June 30, 2005 Wrong function...InputBox:Return Value Success: Returns the string that was entered.Keyword is string.Now we look at the StringIsInt() function.StringIsInt:Checks if a string is an integer$quan = inputbox("test","I need a integer",""," M") If StringIsInt($quan) then MsgBox(0,"test","It's a Integer","") endif ;The MsgBox never come out...... qq Link to comment Share on other sites More sharing options...
nekokk Posted June 30, 2005 Author Share Posted June 30, 2005 (edited) Oh! it's my bad Thank you Burrup. I also have another problem, that is how to check a string returned from inputbox for plus and minus? I would like the users to input integer for a number of array, so if them input a string not integer , it will get an error. $quan = InputBox("Example", "I need an integer", ""," M") If StringIsInt($quan) then; The users can still input an integer like -100, but this will cause global $array[$quan][2] ; an error to declare array. ;How to check minus and plus of an integer? EndIf thank you in advance. I found the function out. Abs function can solve my problem. $quan = InputBox("Example", "I need an integer", ""," M") If StringIsInt($quan) then $quan = Abs($quan) global $array[$quan][2] EndIf Edited June 30, 2005 by nekokk 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