private void BtnRefrescar_Click(object sender, EventArgs e) { dgCliente.Rows.Clear(); txtBuscaDni.Clear(); Cls_N_Clientes objN = new Cls_N_Clientes(); clientes = objN.MtdLeerClientes(); foreach (DataRow fila in clientes.Rows) { dgCliente.Rows.Add(fila[0].ToString(), fila[1].ToString(), fila[2].ToString()); } mtdPintar(); }
private void Form_Clientes_Load(object sender, EventArgs e) { Cls_N_Clientes objN = new Cls_N_Clientes(); clientes = objN.MtdLeerClientes(); foreach (DataRow fila in clientes.Rows) { dgCliente.Rows.Add(fila[0].ToString(), fila[1].ToString(), fila[2].ToString()); } txtBuscaDni.AutoCompleteCustomSource.Clear(); foreach (DataRow r in clientes.Rows) { //getting all rows in the specific field|Column var rw = r.Field <string>("dni"); //Set the properties of a textbox to make it auto suggest and append. txtBuscaDni.AutoCompleteMode = AutoCompleteMode.SuggestAppend; txtBuscaDni.AutoCompleteSource = AutoCompleteSource.CustomSource; //adding all rows into the textbox txtBuscaDni.AutoCompleteCustomSource.Add(rw); } mtdPintar(); }