The 1023.91 is produced from
Decimal.Parse(Math.Round((New Random).NextDouble()*99.99+999.99,2).ToString)
Sub Total = £1023.91
The £102.391 is produced from ( basically 10% of the Sub Total )
string.Format(“Shipping = £{0}”, (SubTotal*Shipping10Percent).ToString)
Shipping = £102.391
Im looking to have the shipping total with only 2 decimals.
Yes Peter that is correct, 2 digits in the format string gives me lets say 1023.91
The issue I have is 10% of this random number.
So 10% of 1023.91 = 102.39, instead im getting 102.391 which is technically correct but I just want 2 decimal places.
Decimal.Parse(Math.Round((New Random).NextDouble()*99.99+999.99,2).ToString)
Produces 1023.91
Above is perfect, gives me 2 decimal places.
string.Format(“Shipping = £{0}”, (SubTotal*Shipping10Percent).ToString)
Basically this gives me 10% of the 1023.91
Produces 102.391
Ideally I would like above to be 2 decimal places, not 3.
I would like either 102.39 or 102.40 (rounded up )
Never ever used that (“F2”) before, learn something new every day.
I noticed (“F”) gives the same output as (“F2”)
Cheers Peter, got there in the end .