I have a form where people enter numbers into text boxes. When they leave the textbox, I format the number into a dollar ammount, meaning I add a dollar sign. I have to do calculations on the field and am running into trouble. I am using the code below. First I strip the dollar sign, then do a try parse to get the number. I ran into trouble when loading the form from a db because negative numbers were being shown with parenthases and not a negative sign.
1. How do I get a decimal out of a string in the format ($4000.00) I would also like to be able to have the function I make be able to handle -$4000.
decimal NetPlannedFee=0;
if (!((decimal.TryParse(txtFe
e.Text.Rep
lace("$","
"), out NetPlannedFee)) && (txtFee.Text != "")))
NetPlannedFee = 0;
Start Free Trial