【问题标题】:Limit selections in a listbox in vb6在 vb6 中限制列表框中的选择
【发布时间】:2017-10-11 13:12:12
【问题描述】:

如何限制VB6ListBox的选择?
我想要什么:用户最多可以从 ListBox 中选择 8 个项目。

我正在使用此代码:

Private Sub lstBox1_Click()
     If lstBox1.SelCount > 8 Then
        MsgBox "Maximum 8 items can be selected."             
       'I want here return false
     End if
End Sub

【问题讨论】:

    标签: vb6 listbox multiple-select


    【解决方案1】:

    答案如下:

    lstBox1.Selected(lstBox1.ListIndex) = False
    

    例子:

    Private Sub lstBox1_Click()
         If lstBox1.SelCount > 8 Then
            MsgBox "Maximum 8 items can be selected."             
           'I want here return false
            lstBox1.Selected(lstBox1.ListIndex) = False
         End if
    End Sub
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-10
      • 1970-01-01
      • 2019-01-18
      • 1970-01-01
      • 2011-01-04
      • 1970-01-01
      相关资源
      最近更新 更多