combobox events

J

Jane

I have a userform with a number of tabs and each tab has a number of lines
with similar text boxes on them. The textboxes are populated by a selection
from the one combo box, on the form (not on a tab). The reason for using
only the one combobox and not a separate combobox for each line is because
the list consists of 7,000+ items and was heavy on memory usage.

I have a series of radio buttons down the side of each tab. The user
selects a radio button adjacent to a line then selects from the combobox.
The selected value is populated into the appropriate line on the appropriate
tab. This all works well except for when the user clicks on a new line and
clicks on the same combobox value as was previously used. Because an actual
change of value did not occur the population of the line doesn't happen. I
have played around with different combobox events without much joy.

I have found a similar posting to this one on another forum but
unfortunately there has been no reponse (poor fellow!).

Has anyone any ideas on how I can overcome this problem?

Jane
 
T

Tom Ogilvy

Private Sub ComboBox1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Combobox1.ListIndex = -1
End Sub
 
J

Jane

Thanks Tom,

It obviously "refreshes" my combobox (removes the previous selection)
through setting Listindex to -1 so forces the user to reselect an item but
that's fine. So my code remains under the _Change event.

I couldn't get Harald's suggestion of using MouseUp or KeyUp to detect a
change in the selection - same result as using Change, BeforeUpdate etc.

Kind regards,
Jane
 
H

Harald Staff

Hi Jane

I read your question as
"except for when the user clicks on a new line and clicks on the same
combobox value as was previously used. Because an actual change of value
did not occur the population of the line doesn't happen. I have played
around with different combobox events without much joy. (...) Has anyone any
ideas on how I can overcome this problem?". That's what beer can do to a
man. But it's worth it <g>.

Best wishes Harald
 
T

Tom Ogilvy

I read this as trying to select a value that was just selected. The new
line appears to refer to the location of the output and not changing a
selection in the listbox. So, to reselect a just selected item:



The mousedown event as posted works for me. In the past, Dick Kusileka has
also suggested this as a solution.

I also understood Jane to say this solved her problem.
 

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

Top