it is such that I must have written price in a string to be displayed to users.
right now will give this error is
Operator \'/\' cannot be
prisenMedlemskab
seems to be a string, so you cannot divide it for a number. Try to convert as follows
Double moms = 1.30;
ButtonPay.Text = "Buy Membership - DKK " + (Convert.ToDouble(prisenMedlemskab) / moms).ToString("F2") + ",- Kr";
By the way is safer to convert prisenMedlemskab
before use it directly so you can check if converted value is a legal one (so if prisenMedlemskab
has an actual convertable value)
As far as I can tell you, prisenMedlemskab
is a string and not an integer
You have to parse it.
e.g.
double prisenMedlemskabDouble = double.Parse(prisenMedlemskab);
And then do
ButtonPay.Text = "Buy Membership - DKK " + (prisenMedlemskabDouble / moms).ToString("F2") + ",- Kr";