//AutoComple private void autoComplete() { List <string> arrays = new List <string>(); arrays.Add(ProductsTable.COLUMN_NAME); //Name listNameProAutoComplete = mainUtils.getListInfosOfAllProduct(arrays); var autoCollection = new AutoCompleteStringCollection(); autoCollection.AddRange(listNameProAutoComplete.ToArray()); this.tbSearchName.AutoCompleteCustomSource = autoCollection; this.tbSearchName.AutoCompleteMode = AutoCompleteMode.Suggest; this.tbSearchName.AutoCompleteSource = AutoCompleteSource.CustomSource; List <string> arraysDesc = new List <string>(); arraysDesc.Add(ProductsTable.COLUMN_DESC); //Desc listDescProAutoComplete = mainUtils.getListInfosOfAllProduct(arraysDesc); var autoDescCollection = new AutoCompleteStringCollection(); autoDescCollection.AddRange(listDescProAutoComplete.ToArray()); this.tbSearchDesc.AutoCompleteCustomSource = autoDescCollection; this.tbSearchDesc.AutoCompleteMode = AutoCompleteMode.Suggest; this.tbSearchDesc.AutoCompleteSource = AutoCompleteSource.CustomSource; }
public OrdersForm(MainForm mainForm, String value) { this.mainForm = mainForm; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OrderForm_Closing); mainUtils = new MainUtils(); DBhelper = new DatabaseHelper(); if (value == null) { // Nothings } else if (value.Equals("ADDNEW")) { addNew = true; } InitializeComponent(); this.CenterToScreen(); updateDataGridViewFirst(); if (addNew) { eventAdd_Click(); } else { loadOrderDetail(IDItemCurrent); } //AutoComple List <string> arrays = new List <string>(); arrays.Add(ProductsTable.COLUMN_NAME); arrays.Add(ProductsTable.COLUMN_ID); listNameProAutoComplete = mainUtils.getListInfosOfAllProduct(arrays); var autoCollection = new AutoCompleteStringCollection(); autoCollection.AddRange(listNameProAutoComplete.ToArray()); this.txtAddProduct.AutoCompleteCustomSource = autoCollection; this.txtAddProduct.AutoCompleteMode = AutoCompleteMode.Suggest; this.txtAddProduct.AutoCompleteSource = AutoCompleteSource.CustomSource; }