Checked List Box Issue

  • Thread starter Thread starter Soulless
  • Start date Start date
S

Soulless

Hi, I have reason to need to use a checked list box. The list box
contents will be filled with filenames in a directory. These values
will change.

I need the ability to be able to select a single item in the list, but
also need to be able to check an item on.

The issue is I only want to allow one checked item at a time. I do
not want to allow multiple items to be checked.

I tried to code for double click and keypress. But if the user clicks
once and then clicks a second time, multiple items get checked on.

Anyone aware of an event or something to code to have only one item
checked during a double click only?

Thanks!
 
Hi, I have reason to need to use a checked list box. The list box
contents will be filled with filenames in a directory. These values
will change.

I need the ability to be able to select a single item in the list, but
also need to be able to check an item on.

The issue is I only want to allow one checked item at a time. I do
not want to allow multiple items to be checked.

I tried to code for double click and keypress. But if the user clicks
once and then clicks a second time, multiple items get checked on.

Anyone aware of an event or something to code to have only one item
checked during a double click only?

Thanks!

Resolved by coding the following in the itemcheck event:

if (checkedListBox.CheckedIndices.Count > 0)
{
if (e.Index != checkedListBox.CheckedIndices[0])
{

checkedListBox.SetItemChecked(checkedListBox.CheckedIndices[0],
false);

}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top