use
TryParse [
^]for casting the string to a numeric type
corrected code:
if ((!string.IsNullOrEmpty(TextBox16.Text.Trim())) && (!string.IsNullOrEmpty(TextBox19.Text.Trim())))
{
decimal a = 0, b = 0;
if (decimal.TryParse(TextBox16.Text.Trim(), out a) && decimal.TryParse(TextBox19.Text.Trim(), out b))
TextBox30.Text = (a + b).ToString();
}