|
-
Dec 4th, 2007, 08:04 PM
#1
Thread Starter
Member
[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?
Last edited by [venom]; Dec 4th, 2007 at 08:32 PM.
-
Dec 4th, 2007, 08:11 PM
#2
Frenzied Member
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
-
Dec 4th, 2007, 08:15 PM
#3
Thread Starter
Member
Re: [VB.net] Input Box - cancel button
That's it.
Thanks Icyculyr
-
Dec 4th, 2007, 08:18 PM
#4
Frenzied Member
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..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|