private void LstLogr_KeyDown(object sender, KeyEventArgs e) { if (LogradouroList.SelectedValue == null) { return; } Endereco_bll enderecoRepository = new Endereco_bll(_connection); if (e.KeyCode == Keys.Escape) { LogradouroList.Visible = false; LogradouroText.Focus(); return; } if (e.KeyCode == Keys.Enter) { LogradouroText.Text = LogradouroList.Text; LogradouroText.Tag = LogradouroList.SelectedValue.ToString(); LogradouroList.Visible = false; CarregaCep(); NumeroList.Focus(); } }
private void TxtLogradouro_KeyDown(object sender, KeyEventArgs e) { if (Convert.ToInt32(CidadeList.SelectedValue) != 413) { CepMask.Text = ""; return; } if (!string.IsNullOrEmpty(LogradouroText.Text) && e.KeyCode == Keys.Enter) { Endereco_bll clsImovel = new Endereco_bll(_connection); List <Logradouro> Listalogradouro = clsImovel.Lista_Logradouro(LogradouroText.Text); LogradouroList.DataSource = Listalogradouro; LogradouroList.DisplayMember = "endereco"; LogradouroList.ValueMember = "codlogradouro"; if (LogradouroList.Items.Count > 0) { LogradouroList.Visible = true; LogradouroList.BringToFront(); LogradouroList.DroppedDown = true; LogradouroList.Focus(); } else { MessageBox.Show("Logradouro não localizado.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); LogradouroText.Focus(); } } else { LogradouroText.Tag = ""; } }
private void CmbBairro_SelectedIndexChanged(object sender, EventArgs e) { LogradouroText.Focus(); }