private void TxtBxCedul_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == Convert.ToChar(Keys.Enter)) { int lim = 10; int res; string Cedula = TxtBxCedula.Text; char[] num = Cedula.ToArray(); if (num.Length == 10) { ClCedula objVerificar = new ClCedula(num, lim); res = objVerificar.Verificar(); if (res > 0) { BttBuscar.Focus(); } else { MessageBox.Show("Cédula Incorrecta"); TxtBxCedula.Text = ""; } } else { MessageBox.Show("Cedula con mayor a 10 dígitos, INCORRECTO"); TxtBxCedula.Text = ""; } } }
private void TxtBxCodigo_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (Char)Keys.Enter) { try { codigo = int.Parse(TxtBxCodigo.Text); if (codigo > 0) { BttBuscar.Focus(); } else { MessageBox.Show("El código debe ser mayor a cero", "¡AVISO!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); TxtBxCodigo.Text = ""; } } catch { MessageBox.Show("El código debe ser un valor númerico", "¡AVISO!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); TxtBxCodigo.Text = ""; } } }
private void TxtBxCodigo_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (Char)Keys.Enter) { try { codigo = int.Parse(TxtBxCodigo.Text); if (codigo > 0) { BttBuscar.Focus(); } else { MessageBox.Show("No se ha encontrado ningun material de seguridad", "¡AVISO!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); TxtBxCodigo.Text = ""; } } catch { MessageBox.Show("No se ha encontrado ningun material de seguridad", "¡AVISO!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); TxtBxCodigo.Text = ""; } } }
private void TxtBxCodigo_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (Char)Keys.Enter) { try { codigo = int.Parse(TxtBxCodigo.Text); if (codigo > 0) { BttBuscar.Focus(); } else { MessageBox.Show("Ingrese solo números enteros", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Warning); TxtBxCodigo.Text = ""; } } catch { MessageBox.Show("Ingrese solo números enteros", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Warning); TxtBxCodigo.Text = ""; } } }