如果之前询问过Dunno,是否可以在VB.NET中禁用CheckListBox中的项目?

问题描述 投票:1回答:1

我有一个代码,但它只填充checkedlistbox中的项目..

Dim lst As New List(Of String) From {dtr.GetInt32("fps_pump_id")}

Do
    For Each items As String In lst
       y = dtr.GetInt32("fps_pump_id") 
       PumpStation.CheckedListBox1.Items.Add(y & " [" & items & "]")
       PumpStation.CheckedListBox1.Items(y).Enabled = False 'this line won't work
    Next
    x += 1
Loop Until x = ps_table.Rows.Count

dtr.getIn32("fps_pump_id")是一个预加载的MySqlDataReader,我用来从我的本地数据库中获取数据

vb.net winforms checkedlistbox
1个回答
0
投票

您可以在复选框中添加项目:

CheckedListBox1.Items.Add(带有{.Text = y&“[”&items&“]”的新ListItem,.Value = y,.Enabled = False})

© www.soinside.com 2019 - 2024. All rights reserved.