Help With Calculating Weight

Roberto

Member
Joined
Mar 9, 2006
Messages
16
Programming Experience
Beginner
Hi, having a problem working out how to convert Stone and Pounds to Pounds

e.g. 10st 13lbs - 153lbs. Or in a textBox: 10.13

Started with:
txtWeightResult.Text = Val(txtWeight.Text * 14) + Val(txtWeight2.Text)

This works but i want a single TextBox to return the result instead. I think the value after the decimal point being more than .9 is causing problems, how could i do this? If anyone could give me a help it would be much appreciated.
 
I think you mean you want to convert '10.13' into '153'. Try this:

VB.NET:
Dim parts as String() = [SIZE=2]txtWeight.Text[/SIZE].Split(".")
[SIZE=2]txtWeightResult.Text [/SIZE]= Val(parts(0)) * 14 + Val(parts(1))
mafro
 
Back
Top