Please, help me to identify problem in my C# code(WPF, event-handler):
private void Discount5Btn_Click(object sender, RoutedEventArgs e)
{
decimal catPr;
decimal salePr;
string catPrStr;
catPrStr = PriceCatTBox.Text;
catPr = decimal.Parse(catPrStr);
salePr = decimal.Multiply(catPr, 0.95m);
SalePriceTBox.Text = (salePr).ToString("0000.00");
}
I can not make it work - debugger shows error on catPr = decimal.Parse(catPrStr);
. Very similar code in another place works. And am I right in such an approach to string-decimal conversion for arithmetic operation?
Edit (added)
Sorry for not specifying catPrStr
value, it is from textbox in the following code (in another event-handler):
dlg.PriceCatTBox.Text = "2300.00";
....
and then as above:
catPrStr = PriceCatTBox.Text;