Filling a ListBox from a ComboBox 
Author Message
 Filling a ListBox from a ComboBox

Hi David.  See if the following works.  Create a Form Level variable that
you set to true whenever the User displays the Drop-Down portion of the
ComboBox, and then set it back to False when the User selects (Clicks) an
item.  Only add items in the Click event when this variable is True (i.e.,
the combobox has been dropped down).

Private mbDropDown As Boolean

Private Sub Combo1_Click()
If mbDropDown = True Then
'add it
List1.AddItem Combo1.Text, 0
'reset the flag
mbDropDown = False
End If
End Sub

Private Sub Combo1_DropDown()
mbDropDown = True
End Sub

'--------
galen


Quote:
> Can anyone help?

> I have a ListBox which I wish to fill from a ComboBox placed below it on
the
> form. The ComboBox has .style = vbComboDrop-DownList because I want the
> selections to be made from the available choices, with no editing of the
> combo's text box.

> The problem is, which combo event to use for adding to the ListBox? The
> natural one -- Click() -- is no good because, although it will trap the
> selection by mouse, it also occurs every time the arrow keys are used to
> slide through the combo list. What I need is a way to register that a
choice
> has been made and the combo's drop-down has been closed up. Is there such
an
> event?

> Any ideas would be welcome.

> David



Fri, 07 Sep 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Using the pipe symbol to fill a listbox or combobox

2. Reference ComboBox item to fill ListBox

3. Fill Listbox with Combobox possible?

4. HOWTO fill in a ListBox or ComboBox

5. Filling a Secondary Combobox based on information from a primary combobox

6. Programatically fill a combobox A2K ??

7. ComboBox Custom Fill Functions

8. fill combobox with contents directory

9. Fill a combobox

10. How to clear a filled combobox

11. Filling a comboBox with ODBC-data

12. Filling a ComboBox with data from DB

 

 
Powered by phpBB® Forum Software