PDA

View Full Version : Solved: Adding & Removing List Box Items



jamescol
06-11-2004, 10:36 PM
Need some help with a Listbox, which I've not used before.

I have a form with 1 Listbox and 2 buttons, and figure many of you already have this Listbox thing down cold :)

Item #1
The first button pops up our Exchange Global Address List, lets users select names, and store those names in an array. I need some code that populates the list box with the array elements.

Item #2
The second button is so far non-functional. I need code that will remove an item(s) from the list that the user selected.

Thanks for any help!

Cheers,
James

mark007
06-12-2004, 03:53 AM
To add items use e.g.:

Me.ListBox1.AddItem MyArray(1)


To remove the selected item use:

Me.ListBox1.RemoveItem Me.ListBox1.ListIndex

:)

Steiner
06-13-2004, 10:50 PM
And if you use MSForms (like in VBA or in a designer in VB 6.0) you can assign the whole array to the list:
ListBox1.List = MyArray

jamescol
06-13-2004, 11:02 PM
Thanks for the help. Both suggestions work fine!

SherryO
10-24-2006, 10:30 AM
Do you still have this code by any chance? If so, would you please post it? Thanks, SherryO

SherryO
10-30-2006, 08:15 AM
I am extremely interested on getting the code that would open the Global Address List. Could you please post it? thanks!!!