Sign in to follow this  
Followers 0
Achilles

Converting string to a number

4 posts in this topic

#1 ·  Posted (edited)

I alright, I have an input box, where the user will presumably put in a number, but when I do GuiCtrlRead($input) it obviously returns it as "56" (or whatever number). Then I do a check to see if the input box has been filled out and I was trying to use "Isnumber(Guictrlread($input)) but it's not working. I didn't see any thing in the helpfile (although I didn't search very hard)... any help greatly appreciated

Edit: Sorry about the typo in my subject name! (But you can't change it, or so I think)

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Maybe something like?

If StringLen(Guictrlread($input)) Then 
    If IsNumber(Guictrlread($input)) Then $number = Number(Guictrlread($input))
EndIf
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

I don't know if I misunderstood question ... but to keep the user from typing letters into the input you could just add the $ES_NUMBER style to the inputbox.

Hallman

Share this post


Link to post
Share on other sites

Maybe something like?

If StringLen(Guictrlread($input)) Then 
    If IsNumber(Guictrlread($input)) Then $number = Number(Guictrlread($input))
EndIf

Alright, sweet, thanks for that gafrost. I used the "$number = Number(Guictrlread($input))" part and that worked fine. I didn't test the other part but I don't think it would of worked because IsNumber(GuiCtrlread($input)) would of returned string with a number in it, and that wouldn't of been accepted as a number.... at least I think that would of happened...

@Hallman: No that isn't really what I was looking for but now that you mention it that would be very useful, thanks!


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
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
Sign in to follow this  
Followers 0