ARCed.Helpers.ControlHelper.Populate C# (CSharp) Method

Populate() public static method

Clears and fills the control with the given data.
Painting is suspended until after items have been added
public static Populate ( ComboBox ctrl, IList data, bool none ) : void
ctrl System.Windows.Forms.ComboBox Combobox control to fill
data IList List of data
none bool Flag to fill the first position with "None"
return void
        public static void Populate(ComboBox ctrl, IList<dynamic> data, bool none)
        {
            ctrl.BeginUpdate();
            ctrl.Items.Clear();
            if (none)
                ctrl.Items.Add("<None>");
            for (int i = 1; i < data.Count; i++)
                ctrl.Items.Add(data[i].ToString());
            ctrl.EndUpdate();
        }

Same methods

ControlHelper::Populate ( ListBox ctrl, IList data, bool none ) : void