Is my ListBox empty?

  • Thread starter Thread starter Michelle
  • Start date Start date
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
 
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
 

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

Back
Top