Question

i'm getting a problem everytime I try to convert an textbox value to a double, the value in the textbox will be used in a calculation with another double, and it's entried from keyboard, everytime i tried to run it I used just numbers on the textbox.

    dim temporaryProduct as string
    Dim value, convertValue, finalValue As Double

temporaryProduct = mathForm.valueBox.tostring ' I've tried with .text too

            If Double.TryParse(temporaryProduct, value) Then 'Convert to double
                convertValue = value
            Else
                MsgBox("Tryparse error")
                Exit Sub
            End If

Everytime i try to convert the textbox string i get "Tryparse error", i really don't know what i'm doing wrong, and i need it to be in double.

Was it helpful?

Solution

Try using just the Text property:

temporaryProduct = mathForm.valueBox.Text

If you use the ToString function on a TextBox, you get something like this:

System.Windows.Forms.TextBox, Text: ???

which is obviously not a value you can use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top