Is my ListBox empty?

M

Michelle

I have a (1-MultiSelectSingle) list box on a form and unfortunately I also
have two questions:

1. I want to check if I've put any entries in it (AddItem)

AND...

2. I want to check if the user has selected any items in the list box.

I've tried ListIndex = 0, but that is True if there are items in the list
and the user has selected the first one.

I'd Appreciate any pointers in the right direction. Thanks.

Michelle
 
P

Peter T

if Listbox1.ListCount > 0 then ' contains entries

idx = ListCount.Listindex

if idx >= 0 then
' item number idx is selected
elseif idx = -1 then
' nothing is selected
End If

Regards,
Peter T
 
Top