简体   繁体   中英

Converting SMS number to double (VB.NET)

I am trying to convert an SMS to double. I'm creating a monitoring system where values like "45.2" are sent to another modem.

I would like to convert 45.2 (which I think is string initially and placed in a textbox) to double so I can do comparison upon receiving it.

I have tried this but got errors:

Dim strMeasurement As String = txtMessage.Text.Trim
Dim dblMeasurement As Double = CDbl(strMeasurement)

Thanks.

as rahul said:
use

Double.tryParse(stringvalue, doublevalueTofill)  

it returns a true if successful otherwise false.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM