Detect Empty List Boxes

watkins
07-18-2003, 06:04 PM
Is there a simple way to detect if a listbox is empty? Basically I have two list boxes, and I move data from one to the other and want to detect if one is empty. Any ideas?

Also how can I detect if in an array of checkboxes nothing has been checked?

Squishy
07-18-2003, 06:10 PM
If List1.ListCount = 0 Then MsgBox "Empty"

Never worked with arrays...I'll let someone else handle that one.

manavo
07-18-2003, 06:17 PM
Simple example :


Private Sub Form_Click()
Dim i As Integer
Dim IsChecked As Boolean

IsChecked = False
For i = Check1.LBound To Check1.UBound
If Check1(i).Value = vbChecked Then
IsChecked = True
Exit For
End If
Next

MsgBox IsChecked
End Sub

blindwig
07-18-2003, 06:26 PM
Simple example :


Private Sub Form_Click()
Dim i As Integer
Dim IsChecked As Boolean

IsChecked = False
For i = Check1.LBound To Check1.UBound
If Check1(i).Value = vbChecked Then
IsChecked = True
Exit For
End If
Next

MsgBox IsChecked
End Sub

or

bolBoxIsEmpty = (lstMyListBox.ListCount > 0)

manavo
07-18-2003, 06:31 PM
bolBoxIsEmpty = Not (List1.ListCount > 0)


I think is correct ;)

blindwig
07-18-2003, 07:21 PM
bolBoxIsEmpty = Not (List1.ListCount > 0)


I think is correct ;)
oh sure... that's correct... if you're the type of person who wants their program to work right... But who would want such a thing? :p

:) Thanks for the correction, but right after I posted I realized it was redudant, beacuse I hadn't seen Photovoltaic's post at first... Don't know how I missed that, posted too quickly again, I guess...

manavo
07-19-2003, 08:18 PM
oh sure... that's correct... if you're the type of person who wants their program to work right... But who would want such a thing?

Thanks for the correction

lol. You're welcome ;)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum