Listbox.CellClick Doesn't Fire On First Click

I’ve been having a problem with Listbox events for some time.

Scenario: I have a populated listbox with multiple columns. When the user clicks on a row, I use the CellClick event to copy data from the row’s cells into a form for editing.

When a row is clicked, nothing happens; when it is clicked again, then the form is populated. And if row x is clicked followed by row y, then row x’s data is copied to the form instead of row y’s.

This behavior is the same if I place the code in the MouseDown event.

I recall doing this same thing in some apps some time ago and everything worked correctly. Any ideas what I’m doing wrong and how to fix this?

What code are you using to get the data from the row that is clicked. If you are using ListIndex, you may find that is not set until after the cell click event. Also, what happens if you return True from the Mousedown and use the MouseUp event to copy your data?

Thanks for the clue(s). I tried those hints and they didn’t work, but it caused me to investigate the events more fully. The Change event takes care of things nicely.