In my form, there is a text box that contains a number for the quantity. then in the event with the changed text this number is placed in the label text property with a currency value (for example: $ 4.00). In my button click event, I am trying to add all the values ββfrom the labels. Using the following code, tryparse fails every time
int num1; string text = lbl85x11bwsub.Text; if (int.TryParse(text, out num1)) { MessageBox.Show(num1.ToString());
but if I try the same using the textbox text property, it will work.
int num2; if (int.TryParse(txt85x11bw.Text, out num2)) { MessageBox.Show(num2.ToString()); } else { MessageBox.Show("it failed"); }
source share