Convert String to Double

Trying to convert a value entered in a textbox to a double or an integer.

Example:

Power.Text (User Field)

PowerVal as a Double

how do I get PowerVal to get the number in Power.Text

The Val method doesn’t seem to work for IOS.

Integer.Parse / Double.Parse
or Integer.FromText / Double.FromText

Thanks Jason. Can you give me an example:

[code]dim s as Text = “3.14159”
dim d as double
d = Double.FromText(s) //Might throw an exception if s is not formatted properly.
d = Double.Parse(s) //safer - similar to what val does in the old framework.

dim i as integer
i = Integer.FromText(s)
i = integer.Parse(s)[/code]

Here is a bit from the program I am working on:

dim Pressure as Variant = CurrentPressure // calls to CurrentPressure and re-classes it

dim Time as string = me.CountUp(myseconds) // calls to time

PressureDataListbox.AddRow(Time, Pressure) // Add row with time in cell 1, Pressure in cell 2

redraw

[quote=174689:@Meade Lewis]Here is a bit from the program I am working on:

dim Pressure as Variant = CurrentPressure // calls to CurrentPressure and re-classes it

dim Time as string = me.CountUp(myseconds) // calls to time

PressureDataListbox.AddRow(Time, Pressure) // Add row with time in cell 1, Pressure in cell 2

redraw[/quote]

So the “CurrentPressure” is a double. I call it as a local variable “Pressure” as a variant.

Works for me. May not be the simplest way…

I’m confused. Are you working in a Desktop or iOS app?

Me? Desktop. It totally works in my program.

Thanks Bob that works perfectly I will use the Parse.