1

I am experiencing a really odd behaviour in a windows forms application I am programming in .NET Framework 4.8. I have tried creating a new project with a windows form just containing a CheckedListBox and I can recreate the same behaviour as in my original project. I have also created a new project with .NET Core 6.0 and can recreate the same behaviour yet again.

The behaviour is recorded here: https://youtu.be/md4SN6kTLFs

In words, I have chosen to use the CheckedListBox with the attribute CheckOnClick, which should check or uncheck the checkbox of the item I am selecting. This works if I select the different items slow enough. If, however, I select them with too fast a pace, the selection will not update and the check/uncheck operation will be executed on the item last selected.

I have similar problems with the checkboxes of TreeView, where the selection isn't updated correctly while selecting items too fast.

I have tried creating the same kind of project on another of my computers and I can not recreate the behaviour there. I am at a loss as to how to proceed with fixing this error. I am worried that I have a greater problem with my development environment and need to find out where the problem is. I don't have a problem switching over to WPF or something like that, but I really would like to get to the bottom with what is happening here.

enter image description here

enter image description here

enter image description here

MotoX
  • 23
  • 4
  • For the `CheckedListBox` with `CheckOnClick` enabled, when you mouse click too fast, it's possible that you are doing mouse double-click on item rather than a single click, the result is the first checked state. So, nothing is wrong here. If you need to disable the double-clicks on items, then you need a custom `CLB` to trap the double click messages to suppress or replace them. – dr.null Oct 05 '22 at 16:02
  • As for the `TreeView` with check boxes, different story. Yes, double clicking rapidly on check boxes does not toggle the checked state to the first one. It performs a single click and the second one is ignored and has no effect. You need to adopt a solution like [this](https://stackoverflow.com/questions/58522970/aftercheck-and-afterselect-events-in-treeview-in-windows-forms/58547452#58547452) one to make the second click counts. – dr.null Oct 05 '22 at 16:08

0 Answers0