//en el evento clic revisamos que todo en los contenedores este de la forma correcta para poder seguir //si no es asi no podemos avanzar private void button1_Click(object sender, EventArgs e) { if (rb_F.Checked) { x = "F"; } else { x = "M"; } if (string.IsNullOrWhiteSpace(txt_matricula.Text) || string.IsNullOrWhiteSpace(txt_nombre.Text) || string.IsNullOrWhiteSpace(txt_correo.Text) || string.IsNullOrWhiteSpace(txt_apP.Text) || string.IsNullOrWhiteSpace(txt_apM.Text) || string.IsNullOrWhiteSpace(cmb_carrera.Text)) { MessageBox.Show("Campos Vacios", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { if (obj.ValidaCorreo(txt_correo.Text, @"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*") == true) { if (MessageBox.Show("¿Desea relizar la actualización?", "Confirmacion", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { obj.Actualizar_Alumnos(txt_matricula.Text, txt_nombre.Text, txt_apP.Text, txt_apM.Text, txt_telefono.Text, txt_correo.Text, cmb_carrera.SelectedValue.ToString(), x); } } } }