如何检查列表框是否被选中
列表1
checkbox item
checkbox Raja
checkbox Raman
checkbox Vijay
从列表1中我想检查复选框是否被选中
如何用vb6编写代码
需要Vb6代码帮助
这是代码:
Private Sub Command1_Click()
If List1.SelCount > 0 Then
MsgBox "Some items are selected"
Else
MsgBox "Sorry,no items are selected !"
End If
End Sub
编辑
如果你想找出选中的项目,你可以这样做:
Private Sub Command2_Click()
Dim i As Long
For i = 0 To List1.ListCount - 1 'loop through the items in the ListBox
If List1.Selected(i) = True Then ' if the item is selected(checked)
MsgBox List1.List(i) ' display the item
End If
Next
End Sub