Connecting Tech Pros Worldwide Help | Site Map

clear a multiple list box

stevenrec
Guest
 
Posts: n/a
#1: Nov 13 '06
Probably very easy question.

I have a list box and have selected several items.
I then create table entries for each item selected.
the list box 'contents' gets smaller since there are less things to
choose.

but the marked 'areas' of the list box are still marked.
how can I get the list box to have nothing selected?

everything I have tried brought the 'invalid use' error

thanks for any help you can provide.

steven

Tanis
Guest
 
Posts: n/a
#2: Nov 13 '06

re: clear a multiple list box



stevenrec wrote:
Quote:
Probably very easy question.
>
I have a list box and have selected several items.
I then create table entries for each item selected.
the list box 'contents' gets smaller since there are less things to
choose.
>
but the marked 'areas' of the list box are still marked.
how can I get the list box to have nothing selected?
>
everything I have tried brought the 'invalid use' error
>
thanks for any help you can provide.
>
steven
click on the row again to deselect it.

fredg
Guest
 
Posts: n/a
#3: Nov 13 '06

re: clear a multiple list box


On 13 Nov 2006 07:57:31 -0800, Tanis wrote:
Quote:
stevenrec wrote:
>
Quote:
>Probably very easy question.
>>
>I have a list box and have selected several items.
>I then create table entries for each item selected.
>the list box 'contents' gets smaller since there are less things to
>choose.
>>
>but the marked 'areas' of the list box are still marked.
>how can I get the list box to have nothing selected?
>>
>everything I have tried brought the 'invalid use' error
>>
>thanks for any help you can provide.
>>
>steven
click on the row again to deselect it.
You can add a command button and use it's click event:

Dim varItem As Variant
For Each varItem In ListBoxName.ItemsSelected
ListBoxName.Selected(varItem) = False
Next varItem

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
stevenrec
Guest
 
Posts: n/a
#4: Nov 14 '06

re: clear a multiple list box


Works great,

makes sense to use the same idea to reset it.
Have been playing with other properties today trying to check if it is
now empty, so it would close the form if there is nothing more to
click.
Pretty simple- just use the listcount property.

Now going to find a way to check the list before the form is shown. If
I try to open the form, would like a message that there is nothing to
display, instead of showing an empty form. Would it be real slow to
open it hidden, set the on open property to check it, and if it is not
empty change to visible, or if empty then a message?

Closed Thread