Chris_Timm
(Chris Timm)
November 14, 2015, 2:49pm
1
I am trying to write an App for the IOS that will calculate the cost of mileage so you would enter the amount of miles and then work out the cost per mile .
I have put this together but it seems there is an issue, looks like VAL is not known … What am I doing wrong
[code] Dim TotalAmount as Integer
Dim RatePerMile as Double
Dim Distance as Double
Dim Extras as Double
RatePerMile = Val(RatePerMileTextField.text)
Distance = Val(DistanceTextField.Text)
Extras = Val(ExtrasTextField.text)
TotalAmount = (RatePerMile x Distance) + Extras[/code]
Val is part of the classic framework and not available in iOS. I think it’s Double.FromText but can’t check now.
Chris_Timm
(Chris Timm)
November 14, 2015, 3:12pm
3
Cool thanks I will have a look.
It all seems to work just fine in the Desktop version.
This handy page shows some of the equivalents between old and new frameworks (and as Kem mentioned, iOS only uses the new):
http://developer.xojo.com/migratingtonewframework
Chris_Timm
(Chris Timm)
November 14, 2015, 8:15pm
5
Ok I have tried this now however I am getting an error …
There is more than one item with this name and its not clear to which this refers.
[code] Dim TotalAmount as Integer
Dim RatePerMile as Double
Dim Distance as Double
Dim Extras as Double
RatePerMile = Double.FromText (RatePerMileTextField.text)
Distance = Double.FromText (DistanceTextField.Text)
Extras = Double.FromText (ExtrasTextField.text)
TotalAmount = (RatePerMile * Distance) + Extras
TotalAmountLabel.Text =Double.ToText(TotalAmount)
[/code]
Should it not be
TotalAmountLabel.Text =Integer(TotalAmount).ToText
On what line(s) are you getting the error?
(Michel, in this case, I think TotalAmount.ToText
will do.)
[quote=229714:@Kem Tekinay]On what line(s) are you getting the error?
(Michel, in this case, I think TotalAmount.ToText
will do.)[/quote]
Yes, it should.
Chris_Timm
(Chris Timm)
November 15, 2015, 9:19am
9
Thanks everyone this is working now.