private void buscarBtn_Click(object sender, EventArgs e) { if (!nomeTb.Text.Equals("")) { List <Model.Editora> editoras = editoraDao.findByNameOrCNJP(nomeTb.Text); if (editoras.Count > 0) { populateGrid(editoras); } } }
private void editoraCb_TextChanged(object sender, EventArgs e) { string editoraTxt = editoraCb.Text; if (editoraTxt.Length > 3 && enableComplete) { List <Editora.Model.Editora> editoras = editoraDao.findByNameOrCNJP(editoraTxt); if (editoras != null && editoras.Count > 0) { editoraCb.DataSource = editoras; var sText = editoraCb.Items[0].ToString(); editoraCb.SelectionStart = editoraTxt.Length; editoraCb.SelectionLength = sText.Length - editoraTxt.Length; editoraCb.DroppedDown = true; return; } else { editoraCb.DroppedDown = false; editoraCb.SelectionStart = editoraTxt.Length; } } }