예제 #1
0
        public static void SelectByValue(this ComboBox comboBox, object value)
        {
            IComboBoxAdapter adapter = comboBox.DataSource as IComboBoxAdapter;

            if ((value == null) && (adapter != null) && adapter.ContainsNull)
            {
                comboBox.SelectedIndex = 0;
                return;
            }
            comboBox.SelectedValue = value;
        }
예제 #2
0
 public static void SetAdapterAsDataSource(this ComboBox comboBox, IComboBoxAdapter adapter)
 {
     comboBox.DataSource    = adapter;
     comboBox.ValueMember   = "Value";
     comboBox.DisplayMember = "Label";
 }