如何检查列表框是否被选中
列表1
checkbox item
checkbox   Raja
checkbox   Raman
checkbox   Vijay
Run Code Online (Sandbox Code Playgroud)
从list1我想检查是否选中了复选框
如何在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
Run Code Online (Sandbox Code Playgroud)
编辑
如果你想找出所选的项目,你可以这样做:
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
Run Code Online (Sandbox Code Playgroud)
        |   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           14819 次  |  
        
|   最近记录:  |