How to Select All in List Box

  • Thread starter Thread starter DOYLE60
  • Start date Start date
D

DOYLE60

I have a combo box on a form. After update, I would like a list box to show
all selected, all blackened. What is the code for such an action?

Also, what is the opposite code? What is the code for deselecting the chosen
items in a list box, making it appear all white?

Boy! Combo boxes are easier!

Thanks,

Matt
 
(e-mail address removed) (DOYLE60) wrote in
I have a combo box on a form. After update, I would like a list box
to show all selected, all blackened. What is the code for such an
action?

Assuming that you have set it to a multiselect, you just manipulate the
Selected() array:

for i = 0 to cboMyCombo.ListCount -1
cboMyCombo.Selected(i) = True
next i
Also, what is the opposite code? What is the code for deselecting the
chosen items in a list box, making it appear all white?

Set them to false.

HTH


Tim F
 
Thanks Tim,
It is not working. It says "Variable not defined" for that "i" below.
Yes, it's a multi-select.

I wish to place this code in the "After Update" of a combo box and in the on
open of the form and perhaps on the single click of a command button. Thanks
again,

Matt

__________________________
 
Also, in the code below, is the "cboMyCombo" part supposed to be the List Box?
I assumed so.

Matt
____________________________

for i = 0 to cboMyCombo.ListCount -1
cboMyCombo.Selected(i) = True
next i
 
(e-mail address removed) (DOYLE60) wrote in m07.aol.com:
It is not working. It says "Variable not defined" for that "i" below.

I left all the stuff like the Dim statements for you... :-) Anything round
here that does not have extensive disclaimers on it is almost always
pseudocode!!

And yes, your original post talked about a combo box, but of course the
multiselect stuff only applies to real lists!

HTH


Tim F
 
Back
Top