【问题标题】:How to disable checkboxes in a ListView (VBA)如何禁用 ListView (VBA) 中的复选框
【发布时间】:2016-06-15 22:07:51
【问题描述】:

在我的用户窗体中,我使用数据库中的数据初始化了一个 ListView:

这只是一个代码sn-p:

While Not rsRL.EOF
  If rsRL("Status").Value = 1 Then
     .ListItems.Add , , rsRL("ID")
     .ListItems(.ListItems.Count).tag = rsRL("RL_Status")
  Else
    // Here I want to disable the checkbox of the corresponding data            
  End If
  .ListItems(.ListItems.Count).ListSubItems.Add , , rsRL("Name")
  .ListItems(.ListItems.Count).ListSubItems.Add , , rsRL("Datum")
  .ListItems(.ListItems.Count).ListSubItems.Add , , rsRL("Typ")

  If rsRL("RL_Status").Value = True Then
      .ListItems(.ListItems.Count).Checked = True
  End If
  rsRL.MoveNext
Wend

在 else-sector 中,我只想显示不带复选框的 ID 或禁用复选框以使其不可点击!我怎样才能做到这一点?

【问题讨论】:

    标签: vba excel listview checkbox


    【解决方案1】:

    以下是隐藏复选框并将值设置为默认值(如果您没有卸载表单或用户可以点击它在分析之前是否应该隐藏它没有有效的选择)

    CheckBox.Visible = False
    CheckBox.Value = False
    

    【讨论】:

    • 你试过 ListView.Checkbox.Visible=False 吗? More info here
    • 这在 excel 2010 中不可用
    猜你喜欢
    • 1970-01-01
    • 2012-05-19
    • 2016-04-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-28
    • 2018-01-16
    • 2010-10-24
    • 2014-07-11
    相关资源
    最近更新 更多