In txtDefinavalor.Text I can only enter values 1% to 999%, so I made code that if value is higher than 100%, change value of textbox to 100%. To do it, I removed % from textbox and made if code using convert.int32 (had same error), then tried int32.Parse (had same error).
Error is "Input String was not in incorrect format" on line:
string valor = txtDefinavalor.Text.Replace("%", string.Empty); I think as textbox after replace % for "" already is integer number and wasnt need convert, but I can't make string > value
see full code:
if (rbtPercentualmensal.Checked || rbtPercentualmedioanual.Checked) { string valor = txtDefinavalor.Text.Replace("%", string.Empty); if (Int32.Parse(valor) > 100) { txtDefinavalor.Text = "100%"; } } How solve it?
txtDefinavalor.Text.Replace("%", string.Empty).Trim(), but better if you put a break point and see what is inside the text