Escolar Documentos
Profissional Documentos
Cultura Documentos
public Form1()
InitializeComponent();
try
nota1 = Convert.ToDecimal(txtNota1.Text);
nota2 = Convert.ToDecimal(txtNota2.Text);
nota3 = Convert.ToDecimal(txtNota3.Text);
nota4 = Convert.ToDecimal(txtNota4.Text);
maiornota = Convert.ToDecimal(IsTextValidated(lblMaiorNota.Text));
menornota = Convert.ToDecimal(IsTextValidated(lblMenorNota.Text));
media = Convert.ToDecimal(IsTextValidated(lblMedia.Text));
if (nota1 > nota2 && nota1 > nota3 && nota1 > nota4)
maiornota = nota1;
else if (nota2 > nota1 && nota2 > nota3 && nota2 > nota4)
maiornota = nota2;
else if (nota3 > nota1 && nota3 > nota2 && nota3 > nota4)
maiornota = nota3;
else
maiornota = nota4;
if (nota1 < nota2 && nota1 < nota3 && nota1 < nota4)
menornota = nota1;
else if (nota2 < nota1 && nota2 < nota3 && nota2 < nota4)
menornota = nota2;
}
else if (nota3 < nota1 && nota3 < nota2 && nota3 < nota4)
menornota = nota3;
else
menornota = nota4;
lblMaiorNota.Text = maiornota.ToString();
lblMenorNota.Text = menornota.ToString();
lblMedia.Text = media.ToString();
catch (FormatException)
"Mensagem do Sistema");
return !objNotWholePattern.IsMatch(strTextEntry);
}
//Limpo as variáveis
txtNota1.Text = "";
txtNota2.Text = "";
txtNota3.Text = "";
txtNota4.Text = "";
lblMaiorNota.Text = "";
lblMenorNota.Text = "";
lblMedia.Text = "";
lblResultado.Text = "";
DialogResult result;
if (result == System.Windows.Forms.DialogResult.Yes)
this.Close();
{
//Teste condicional para aceitar números no textbox
if (!(char.IsDigit(e.KeyChar)))
e.Handled = true;
e.Handled = false;
if (!(char.IsDigit(e.KeyChar)))
e.Handled = true;
e.Handled = false;
if (!(char.IsDigit(e.KeyChar)))
e.Handled = true;
}
e.Handled = false;
if (!(char.IsDigit(e.KeyChar)))
e.Handled = true;
e.Handled = false;
Calcular();
Limpar();
}
private void btnSair_Click(object sender, EventArgs e)
Sair();