compact framework equivalent?

C

Craig G

i want to use this on my pda app but it appears the compact framework doesnt have a TryParse method for textboxes

Dim theValue As Double



If theValue.Parse(TextBox1.Text, Globalization.NumberStyles.Float, Application.CurrentCulture.NumberFormat, theValue) = True then

MsgBox("True")

Else

MsgBox("False")

' Not a valid number

End If
 
C

Craig G

should read theValue.TryParse........
i want to use this on my pda app but it appears the compact framework doesnt have a TryParse method for textboxes

Dim theValue As Double



If theValue.Parse(TextBox1.Text, Globalization.NumberStyles.Float, Application.CurrentCulture.NumberFormat, theValue) = True then

MsgBox("True")

Else

MsgBox("False")

' Not a valid number

End If
 
J

Jon Skeet [C# MVP]

Craig G said:
i want to use this on my pda app but it appears the compact framework
doesnt have a TryParse method for textboxes

Dim theValue As Double

If theValue.Parse(TextBox1.Text, Globalization.NumberStyles.Float,
Application.CurrentCulture.NumberFormat, theValue) = True then

MsgBox("True")
Else
MsgBox("False")
' Not a valid number
End If

Use Double.Parse and catch FormatException - if the call succeeds, it's
a valid number, otherwise it's not.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top