I have a problem in my windows form in c#. The program is simple; there are 3 textboxes and then it sums their values. however, when i click on the sum button without entering any values in the other 3 textboxes, the program crashes.
How can i make these textboxes accept only positive numbers and zeros? this is what i did
private void button1_Click(object sender, EventArgs e)
{
double FirstNumb = Convert.ToDouble(txtFirstValue.Text);
double SecondNumb = Convert.ToDouble(txtSecondValue.Text);
double ThirdNumb = Convert.ToDouble(txtThirdValue.Text);
double m;
m = FirstNumb + SecondNumb + ThirdNumb;
listBox1.Items.Add(m);
}