[VB.net] Input Box - cancel button
Hi there, I have a problem with INPUT BOX.
This is it:
Code:
dim variable1 as double
variable1 = CDbl(InputBox("What is your height?"))
Now, varible1 is double and whem I enter value into input box it is working.
Problem:
When I click cancel button, it sends empty string to this variable which leads to this error.
Conversion from string "" to type 'Double' is not valid.
Any help for me? :(
Re: [VB.net] Input Box - cancel button
Code:
Dim MyDouble As Double = 0
Dim SafelyConverted As Boolean = Double.TryParse(InputBox("What is your height?"), MyDouble)
Cheers
Re: [VB.net] Input Box - cancel button
That's it.
Thanks Icyculyr
Re: [VB.net] Input Box - cancel button
NP please mark your thread as resolved, by editing the first post and selecting the 'Green Tick' at the bottom of the page..