{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double SalarioBase = 0, Descontos = 0, Vantagens = 0;
try
{
SalarioBase = Convert.ToDouble(textBox1.Text);
Vantagens = Convert.ToDouble(textBox2.Text);
Descontos = Convert.ToDouble(textBox3.Text);
}
catch
{
MessageBox.Show("Valores Invalidos");
return;
}
textBox4.Text = Convert.ToString (( SalarioBase + Vantagens ) - Descontos);
}
}
What's the difference between using if
and try