huldu Posted December 31, 2005 Share Posted December 31, 2005 I just found out that using GUICtrlRead, for example in GUICtrlCreateInput will turn what was typed in into a string. Ok nothing wrong with that!. What i was wondering how do i turn a string into a number. I have a small script that waits for user to input a number. The user writes a number and press "accept" (everything works sofar). Now the problems starts, i made a check to see if the user wrote anything but numbers as a safety switch. The problem is this safety switch isnt letting the string thru, even tho its only numbers in it. I havent "programed" in years and dont remember anything, but i do recall something in C++ that could "convert" a string to int?. So i was just wondering if there is any way to check a "string" for bogus letters, if any were found it would stop and error would pop up. However if only letters were found in the string it would turn the string into a "number" that IntNumber would let thru. This maybe was a bit complicated, but im pulling my hair out trying to figure this one out and i dont have much hair left now lol. "I'm paper, rock is fine, nerf scissors!!!" Link to comment Share on other sites More sharing options...
LxP Posted December 31, 2005 Share Posted December 31, 2005 StringIsInt() and Number() sound like what you want. Link to comment Share on other sites More sharing options...
huldu Posted December 31, 2005 Author Share Posted December 31, 2005 (edited) Wait i maybe found the solution myself! If i turned GUICtrlCreateInput("", 56, 176, 49, 21, -1, $WS_EX_CLIENTEDGE) into: GUICtrlCreateInput("", 56, 176, 49, 21, -1, $ES_NUMBER) It would only allow digits to be typed in? but it would still be a string of course, but if nothing but letters can be typed i guess thats good enough Another thing, is it possible to add more then 1 "edit styles" to a control? like... GUICtrlCreateInput("", 56, 176, 49, 21, -1, $ES_NUMBER, $WS_EX_CLIENTEDGE) ? -- Wow you guys got the best reply speed ive ever seen on a forum! Edited December 31, 2005 by huldu "I'm paper, rock is fine, nerf scissors!!!" Link to comment Share on other sites More sharing options...
w0uter Posted December 31, 2005 Share Posted December 31, 2005 (edited) make'ing a wrapper for GetDlgItemInt is also a possibility. and you can BitOR() styles together. Edited December 31, 2005 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll 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