I want to bind a ComboBox with checked items from CheckedListBox based on selection made by user.
This is how I bind ComboBox:
private void LoadFOCOutlets()
{
ArrayList outletList = new ArrayList();
Outlet objOutlet = new Outlet();
for (int i = 0; i < customCheckListBoxOutletList.CheckedItems.Count; i++)
{
objOutlet = (Outlet)customCheckListBoxOutletList.Items[i];
outletList.Add(objOutlet);
}
objOutlet.OutletID = 0;
objOutlet.OutletName = "Select Outlet";
outletList.Insert(0, objOutlet);
cmbFOCOutlets.DataSource = outletList;
cmbFOCOutlets.DisplayMember = "OutletName";
cmbFOCOutlets.ValueMember = "OutletID";
cmbFOCOutlets.DropDownStyle = ComboBoxStyle.DropDownList;
}
So, every time when a user check a new item, it should re-bind the ComboBox. The above code works fine.
But which event of CheckedListBox can I use to re-bind the ComboBox after a new item has been checked? I tried using ItemCheck Event. But It doesn't count the current selection.
Any help will be very much appreciated.