-3
**Good afternoon, I’m running a basic program to improve programming but I’m having an error here, I’ve tried several ways and I can’t. It is a IMC calculation program in Windows Form, but when the program runs the Height and Weight field appears and when the user went to enter the data did not want the two fields to be blank because it seems to me that the cannot do pq the value is double and only has to check string because it is textbox, when I press the button to calculate with empty fields it closes at the height = Convert.todouble(txtaltura.text);. The beginning of the cogido is like this: Can someone help me? Double Height, Weight, BMI;
Altura = Convert.ToDouble(txtAltura.Text);
Peso = Convert.ToDouble(txtPeso.Text);
if (txtAltura == null && txtPeso == null)
{
MessageBox.Show("DIGITE UM VALOR");
}
else
{
Altura = Convert.ToDouble(txtAltura.Text);
Peso = Convert.ToDouble(txtPeso.Text);
imc = Peso / (Altura * Altura);**
please uppercase letters on the internet means it’s screaming, please, "down-the-tone-of-voice" on the title!
– balexandre
Okay, it’s bad because I’m new here on the site and don’t deduce it. Thanks!
– Cledson Paranhos