2
Answers

how to convert string value into decimal in vb c#?

i am trying to convert textbox value into decimal for multiply purpose , tried the below code

copy_qty.Text = Q123.34;
copy_box.Text = 10;
string str_qty = copy_qty.Text.Substring(1);
decimal qty_val = decimal.Parse(str_qty);
int box_val = int.Parse(copy_box.Text);
decimal total = qty_val * box_val;
total_qty.Text = total.ToString();

i am getting 12334 in qty_val instead of 123.34,

how to parse string value into decimal ?

FYI,

i have also tried the below code but no luck,
string getnumber = "11.145";
decimal decinum = Convert.ToDecimal(getnumber);

getting 11145 instead of 11.145

any suggestion ?

Answers (2)