private void SetControlsLookUpEditProductList() { var sqlConn = new SqlConn(DbConnectionString()); var sett = Properties.Settings.Default; int factoryId = sett.Factory; string customerId = lookUpEdit_Customer.EditValue.ToString(); string sqlQuery = "SELECT * FROM v_ButcherLabelsProductList WHERE IdCustomer=" + customerId + " AND IdFactory=" + factoryId + ""; var dt = new DataTable(); dt = SqlDataTable.GetDatatable(sqlConn.GetSqlConnection(), sqlQuery); lookUpEdit_Product.Enabled = true; lblColorLabel.Text = string.Empty; var control = lookUpEdit_Product.Properties; control.DataSource = null; control.DataSource = dt; control.DisplayMember = "Description"; control.ValueMember = "ProdCode"; control.AppearanceDropDown.FontSizeDelta = 10; control.AppearanceDropDownHeader.FontSizeDelta = 10; LookUpColumnInfoCollection columns = control.Columns; columns.Clear(); columns.Add(new LookUpColumnInfo("ProdCode", 150, "Code")); columns.Add(new LookUpColumnInfo("Description", 400, "Description")); columns.Add(new LookUpColumnInfo("CustomerName", 120, "Customer")); columns.Add(new LookUpColumnInfo("LabelType", 100, "Label")); }
private void SetControlsLookUpEdit(LookUpEdit control, DataTable dataTable, string displayMember, string valueMember, string caption) { var _control = control.Properties; _control.DataSource = null; _control.DataSource = dataTable; _control.DisplayMember = displayMember; _control.ValueMember = valueMember; _control.AppearanceDropDown.FontSizeDelta = 12; _control.AppearanceDropDownHeader.FontSizeDelta = 12; LookUpColumnInfoCollection column = _control.Columns; column.Clear(); column.Add(new LookUpColumnInfo(displayMember, caption)); }