private void NumeroDenteTB_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (NumeroDenteTB.Text.Length > 0) { CRUD.Read read = new CRUD.Read(); var dente = read.GetDente(Convert.ToInt32(NumeroDenteTB.Text)); NumeroDenteTB.Text = dente.NDente.ToString(); NomeDenteTB.Text = dente.Nome; ListaEstadosLB.Focus(); } else { string[] colunas = new string[2]; colunas[0] = "NDente"; colunas[1] = "Nome"; var pesquisa = new Pesquisa("Dentes", "Nome", "NDente", colunas); pesquisa.ShowDialog(); if (pesquisa.Codigo > 0) { NumeroDenteTB.Text = pesquisa.Codigo.ToString(); NomeDenteTB.Text = pesquisa.Selecionado; ListaEstadosLB.Focus(); } } } }
private void QtTB_Leave(object sender, EventArgs e) { try { if (int.Parse(QtTB.Text) > 0) { qt = int.Parse(QtTB.Text); } else { QtTB.Text = qt.ToString(); } ListaEstadosLB.Focus(); } catch (Exception) { QtTB.Text = qt.ToString(); } }
private void QtTB_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { try { if (int.Parse(QtTB.Text) > 0) { qt = int.Parse(QtTB.Text); } else { QtTB.Text = qt.ToString(); } ListaEstadosLB.Focus(); } catch (Exception) { } } }