ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   combobox events (https://www.excelbanter.com/excel-programming/318919-combobox-events.html)

Jane

combobox events
 
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

Harald Staff

combobox events
 
Hi Jane

Did you try the MouseUp and KeyUp events ?

HTH. Best wishes Harald

"Jane" skrev i melding
...
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




Tom Ogilvy

combobox events
 
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

--
Regards,
Tom Ogilvy

"Jane" wrote in message
...
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




Jane

combobox events
 
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

"Tom Ogilvy" wrote:

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

--
Regards,
Tom Ogilvy

"Jane" wrote in message
...
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





Harald Staff

combobox events
 
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

"Jane" skrev i melding
...
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




Tom Ogilvy

combobox events
 
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.

--
Regards,
Tom Ogilvy


"Harald Staff" wrote in message
...
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

"Jane" skrev i melding
...
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







All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com