I have a form with multiple labels that have currency values and I have a button that sums the totals in another label. I am trying to check for null values, but now I can't add the values because the variable is outside the scope of the method. At least I beleive that's why I'm getting the error.
private void cmdcalculate_Click(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(lbl85x11bwsub.Text))
{
string s = lbl85x11bwsub.Text;
decimal value = decimal.Parse(s, NumberStyles.Currency);
}
decimal total = 0;
total += (value);
lblsubtotal.Text = total.ToString("C");
}