private void TxtBxNombre_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == Convert.ToChar(Keys.Enter)) { string Nombre = TxtBxNombre.Text; char[] num = Nombre.ToArray(); r = 0; a = 0; for (int i = 0; i < num.Length; i++) { if ((num[i] >= 65 && num[i] <= 90) || (num[i] >= 97 && num[i] <= 122) || num[i] == 127) { r++; } else { a++; } } if (a > 0) { MessageBox.Show("Ingrese solo letras"); TxtBxNombre.Text = ""; } else { CmbBxMarca.Focus(); } } }
private void comboBox1_ValueMemberChanged(object sender, EventArgs e) { try { estado = CmbBxMarca.SelectedItem.ToString(); if (estado == "") { MessageBox.Show("No se ha seleccionado ningun dato", "¡Atencion!", MessageBoxButtons.OK, MessageBoxIcon.Warning); CmbBxMarca.Focus(); } else { TxtBxNombreUsuario.Focus(); } } catch { MessageBox.Show("Valores mal ingresados, seleccione los valores en la flecha", "¡Atención!", MessageBoxButtons.OK, MessageBoxIcon.Warning); CmBxEstado.Text = ""; } }