this is an additional question of select one value of checkboxCombobox
i needed for a particular situation a checkbox-combobox with actions like a regular combobox. i needed to be able to select only one value at a time. i got that figured out now. my next problem is:
private void PreDefSerials_SelectedValueChanged(object sender, EventArgs e)
{
if (PreDefSerials.SelectedIndex > -1)
{
// shut down the evenhandler
PreDefSerials.SelectedValueChanged -= PreDefSerials_SelectedValueChanged;
// get the selected items name.
string test = PreDefSerials.SelectedItem.ToString();
// deselect all boxes
for (int i = 0; i < PreDefSerials.CheckBoxItems.Count; i++)
{
PreDefSerials.CheckBoxItems[i].CheckState = CheckState.Unchecked;
}
if(test != "")
// select the selected text again
PreDefSerials.CheckBoxItems[test].CheckState = CheckState.Checked;
// reinstate the eventhandler
PreDefSerials.SelectedValueChanged += PreDefSerials_SelectedValueChanged;
}
}
my problem now is that when I select a second item in the checkbocombobox the selected item is (item1, item2). with this name my recheck of the item is not working.
how can I get only the recent clicked item of a checkboxcombobox?
why do i always want to do it the hard way! why try to use a checkboxcombobox as combobox? just because i have it on my form alreaddy!.
there is a better and way more easy way to accomplish this problem! add a combobox. so i did. my new solution is an invisible combobox on the same spot as the checkboxcombobox. when a certain event occurs my combobox will be made visible and my checkboxcombobox will be made invisible.
and the combobox will disapear again when my actions are done. everyone thanks for thinking with me.