/// <summary> /// fills a combobox with the subject data /// </summary> /// <param name="cb"></param> /// <param name="value"></param> public void FillCombobox(ref AdvancedComboBox cb, object value) { table = FillObject(); cb.DataSource = table; cb.ValueMember = "ID"; cb.DisplayMember = "Kürzel"; cb.SelectedValue = value; }
/// <summary> /// fills the combobox of book search with data /// </summary> /// <param name="cb">refering combobox</param> /// <param name="klassenstufe"></param> /// <param name="value"></param> public void FillComboboxSearch(ref AdvancedComboBox cb, int grade, object value) { DataTable table = FillObjectSearch(grade); if (table == null) { return; } cb.DataSource = table; cb.ValueMember = "ISBN"; cb.DisplayMember = "Titel"; cb.SelectedValue = value; }
/// <summary> /// fills a combobox with data /// </summary> /// <param name="cb"></param> /// <param name="value"></param> /// <param name="adapter"></param> /// <param name="table"></param> public void FillCombobox(ref AdvancedComboBox cb, object value, ref DataTable table, AutoCompleteSource autoCompleteSource = AutoCompleteSource.None) { if (cb.AutoCompleteSource != autoCompleteSource) { cb.AutoCompleteSource = autoCompleteSource; } table = FillObject(); if (table == null) { return; } cb.DataSource = table; cb.ValueMember = FieldId; cb.DisplayMember = FieldName; cb.SelectedValue = value; }
//private bool AlreadyExists(string klassename) //{ // if (con.ConnectError()) return false; // string RawCommand = "SELECT k_id from [dbo].[t_s_klassen] where k_bezeichnung=@0"; // SqlDataReader dr = con.ExcecuteCommand(RawCommand, klassename); // dr.Read(); // if (dr.HasRows) // { // dr.Close(); // con.Close(); // return true; // } // else // { // dr.Close(); // con.Close(); // return false; // } //} /// <summary> /// fills a combobox with data /// </summary> /// <param name="cb"></param> /// <param name="value"></param> public void FillCombobox(ref AdvancedComboBox cb, object value, AutoCompleteSource autoCompleteSource = AutoCompleteSource.None) { c.FillCombobox(ref cb, value, ref table, autoCompleteSource); cb.SelectedValue = value; }
/// <summary> /// /// </summary> /// <param name="ddl"></param> /// <param name="value"></param> public static void SelectItem(this AdvancedComboBox ddl, string value) { ddl.SelectedIndex = ddl.FindString(value) != -1 ? ddl.FindString(value) : 0; }