I have a form with a field cdnsale that is formated as currency but when I try to do a calculation with it it errors out as a division by zero; however if i format it as numerical i do not get this error. Can anyone help me to change my code so I can format as currency and not get this error. My current code is as follows:
decimal cdnsale;
decimal.TryParse (tRECREVHMTextBox.Text,out cdnsale);
decimal profit;
decimal grossprofpercent;
grossprofpercent = Math.Round(profit / cdnsale,2);
decimal cdnsale;
decimal.TryParse (tRECREVHMTextBox.Text,out cdnsale);
decimal profit;
decimal grossprofpercent;
grossprofpercent = Math.Round(profit / cdnsale,2);