Listbox Help (remove selected item)

S

sk

This should be easy but I can not get it to work.

I have a simple listbox with Row Source Type property of value/list. It is
not mult select. I am using .additem to load the listbox and am not using
the itemdata property. I want to be able to select an item in the listbox,
click a button on the form to get the value in column 1 of the selected item,
then remove the selected item from the list box.

Thanks in advance for any help
 
S

Stuart McCall

sk said:
This should be easy but I can not get it to work.

I have a simple listbox with Row Source Type property of value/list. It
is
not mult select. I am using .additem to load the listbox and am not using
the itemdata property. I want to be able to select an item in the
listbox,
click a button on the form to get the value in column 1 of the selected
item,
then remove the selected item from the list box.

Thanks in advance for any help

Declare a variable (MyVariable) of the correct type to receive a value from
the first column, then in your button's click event:

With Me.ListboxName
MyVariable = .Column(0)
.RemoveItem .ListIndex
End With
 

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