Sign in to follow this  
Followers 0
ojef1

variable types question

4 posts in this topic

In my program I use an input box to accept an excel row number. However, isInt($row) returns a 0. I assume this is because inputBox only accepts strings, but when I use $row to do an _ExcelReadCell it works no problem. How is _ExcelReadCell able to decipher this without an error?

The reason I ask is because I'd like to make sure the user inputs a valid integer. Any suggestions?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You can do that with this function, Number, the InputBox can also be set to only accept digits.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

the InputBox can also be set to only accept digits.

afaik not, I only know this for Controls created by GuiCtrlCreateInput, GuiCtrlEdit but Bot for InputBox.

autoBert

Edited by AutoBert

Share this post


Link to post
Share on other sites

afaik not, I only know this for Controls created by GuiCtrlCreateInput, GuiCtrlEdit but Bot for InputBox.

autoBert

Well .... this should do it?

$Number = 'Yes'
While StringRegExp($Number, "[^0-9]")
    $Number = InputBox("Numbers only!", "Enter a 1 or 2 Number Row .", "", " M2")
    If @error > 0 Then Exit
    Sleep(13)
WEnd
MsgBox(0, '', 'Yes, This was Row number: ' & Number($Number)

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