private void BtnCalcular_Click(object sender, EventArgs e) { if (TxtNota1.Text.Trim().Length == 0) { MessageBox.Show("Ingrese el Primer Valor"); TxtNota1.Focus(); return; } if (TxtNota2.Text.Trim().Length == 0) { MessageBox.Show("Ingrese el Segundo Valor"); TxtNota2.Focus(); return; } if (TxtNota3.Text.Trim().Length == 0) { MessageBox.Show("Ingrese el Tercer Valor"); TxtNota3.Focus(); return; } if (TxtNota4.Text.Trim().Length == 0) { MessageBox.Show("Ingrese el Cuarto Valor"); TxtNota4.Focus(); return; } double n1, n2, n3, n4, r; n1 = Convert.ToDouble(TxtNota1.Text); n2 = Convert.ToDouble(TxtNota2.Text); n3 = Convert.ToDouble(TxtNota3.Text); n4 = Convert.ToDouble(TxtNota4.Text); r = (n1 + n2 + n3 + n4) / 4; TxtPromedio.Text = r.ToString(); }
private void BtnLimpiar_Click(object sender, EventArgs e) { TxtNota1.Text = String.Empty; TxtNota2.Text = String.Empty; TxtNota3.Text = String.Empty; LblPromedio.Text = "0"; TxtNota1.Focus(); }
private void BtnLimpiar_Click(object sender, EventArgs e) { TxtNota1.Text = null; TxtNota2.Text = null; TxtNota3.Text = null; TxtNota4.Text = null; TxtNota5.Text = null; LblResultado.Visible = false; TxtNota1.Focus(); }
private void BtnLimpiar_Click(object sender, EventArgs e) { TxtNota1.Text = String.Empty; TxtNota2.Text = String.Empty; TxtNota3.Text = String.Empty; TxtNota4.Text = String.Empty; TxtNota5.Text = String.Empty; label7.Visible = false; lblPromedio.Text = "0"; lblPromedio.Visible = false; TxtNota1.Focus(); }
private void BtnAgregar_Click(object sender, EventArgs e) { if (TxtNombreE.Text.Trim().Length == 0) { POO.MsgWarning("El Campo Nombre es Requerido."); TxtNombreE.Focus(); return; } if (TxtNota1.Text.Trim().Length == 0) { POO.MsgWarning("El Campo Nota 1 es Requerido."); TxtNota1.Focus(); return; } if (TxtNota2.Text.Trim().Length == 0) { POO.MsgWarning("El Campo Nota 2 es Requerido."); TxtNota2.Focus(); return; } if (TxtNota3.Text.Trim().Length == 0) { POO.MsgWarning("El Campo Nota 3 es Requerido."); TxtNota3.Focus(); return; } if (TxtNota4.Text.Trim().Length == 0) { POO.MsgWarning("El Campo Nota 4 es Requerido."); TxtNota4.Focus(); return; } if (POO.CheckIfIsNumber(TxtNota1.Text.Trim()) == "N") { POO.MsgWarning("El Valor en El Campo Nota 1 Debe Ser Numerico."); TxtNota1.Focus(); return; } if (POO.CheckIfIsNumber(TxtNota2.Text.Trim()) == "N") { POO.MsgWarning("El Valor En El Campo Nota 2 Debe Ser Numerico."); TxtNota2.Focus(); return; } if (POO.CheckIfIsNumber(TxtNota3.Text.Trim()) == "N") { POO.MsgWarning("El Valor En El Campo Nota 3 Debe Ser Numerico."); TxtNota3.Focus(); return; } if (POO.CheckIfIsNumber(TxtNota4.Text.Trim()) == "N") { POO.MsgWarning("El Valor En El Campo Nota 4 Debe Ser Numerico."); TxtNota4.Focus(); return; } string nomb, n1, n2, n3, n4, prom; nomb = TxtNombreE.Text.Trim(); n1 = TxtNota1.Text.Trim(); n2 = TxtNota2.Text.Trim(); n3 = TxtNota3.Text.Trim(); n4 = TxtNota4.Text.Trim(); prom = TxtPromedioE.Text.Trim(); DgvDatosE.Rows.Add(nomb, n1, n2, n3, n4, prom); TxtNombreE.Clear(); TxtNota1.Clear(); TxtNota2.Clear(); TxtNota3.Clear(); TxtNota4.Clear(); TxtPromedioE.Clear(); TxtNombreE.Focus(); }