private void valueComboDropDown(object sender, EventArgs e) { using (AutoCursor.DatabaseCall) { try { lastErrorStripLabel.Text = ""; if (valueCombo.Items.Count > 0) return; int field; int noFields = pcTable.noFields; int offsetFields = pcTable.offsetFields; for (field = 0; field < noFields; field++) if (lookupCombo.Text.CompareTo(pcFields[field + offsetFields].name) == 0) break; if (field > noFields) return; DBHandler db = new DBHandler(connect); db.GetDistinctList(pcTable.name, pcFields[field + offsetFields]); db.PopulateCombo(valueCombo); } catch (Exception ex) { showException(ex); } } }
private void populateCombo(ComboBox combo, int tableIndex) { using (AutoCursor.DatabaseCall) { try { TPCTable pcTable = pcTables[tableIndex]; lastErrorStripLabel.Text = ""; DBHandler db = new DBHandler(connect); setDB(db, pcTable.name); db.Lookup = ""; db.GetTable(pcTable.name, pcFields, pcTable.offsetFields, pcTable.noFields, pcOrderFields, pcTable.offsetOrderFields, pcTable.noOrderFields); db.PopulateCombo(combo, pcKeyFields, pcTable.offsetKeyFields, pcTable.noKeyFields); } catch (Exception ex) { showException(ex); } } }