Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox item count problems

Status
Not open for further replies.

unclesvenno

Programmer
Sep 12, 2004
33
AU
I have a listbox which is filled as the result of a query. No problems filing the listbox, however i want to put in a test if the listbox contains no data. I have used the MsgBox to output the size and I constantly get "1". I get this result even when the listbox is empty. I thought if I'm putting the column headings in then that may indicate a 1 if there is no other data but I don't understand why the count would remain "1" when there is clearly more than that in there?

MsgBox lsbOrderedFiles.ListCount

'Test listbox for data
If (lsbOrderedFiles.ListCount <= 1) Then
cmdExport.Enabled = False
cmdRemove.Enabled = False
cmdClearAll.Enabled = False
End If

Thanks again,
Uncle Svenno

ps. how do I put my code sample in a "code box" on this forum?
 
DISREGARD THIS THREAD

I realise what I was doin, I was testing the ListBox for data prior to filling it, derrrr

Sorry,
Uncle Svenno

ps. If your feeling like being helpful, perhaps check my next post :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top