private void txtDescripcion_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtDescripcion.Text != "") { Fpagos pagos = new Fpagos(); using (pagos) { List <Fpagos> result = pagos.getpagosbydescripcion(txtDescripcion.Text); txtCodigo.Text = string.Format("{0:00}", Convert.ToInt16(result[0].Id)); } } } }
private AutoCompleteStringCollection cargadatos() { AutoCompleteStringCollection datos = new AutoCompleteStringCollection(); Fpagos pagos = new Fpagos(); using (pagos) { List <Fpagos> result = pagos.getpagos(); foreach (Fpagos item in result) { datos.Add(item.Id.ToString()); } } return(datos); }