private void btnAgregar_Click(object sender, EventArgs e) { try { decimal total1 = 0; total1 += Convert.ToDecimal(txtPonderacion.Text) + Sumatoria(); if (total1 > pr.Periodoporcentaje(rbp35, rbs35, rb30) || decimal.Parse(txtPonderacion.Text.ToString()) <= 0 || !validaractividad(txtActividad) || txtActividad.Text == "") { if (total1 > pr.Periodoporcentaje(rbp35, rbs35, rb30)) { MessageBox.Show("La sumatoria de los porcentajes de las actividades" + "\n exceden el pocentaje del periodo", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (total1 < 0) { MessageBox.Show("Ingrese un porcentaje válido", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtActividad.Text == "") { MessageBox.Show("Ingrese una actividad", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { pr.InAct(cbSeccion, txtActividad, cbMateria, cbGrado, rbp35, rbs35, rb30, txtPonderacion, dgvactividades, rbt1, rbt2, rbt3); lbltotal.Text = Convert.ToString(total1); } txtPonderacion.Text = ""; txtActividad.Text = ""; } catch (Exception) { MessageBox.Show("Ingrese una ponderación válida", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPonderacion.Text = ""; } }