在VB.NET中禁用CheckListBox中的项目?

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

我在这里有代码,但只填充了复选框中的项目。

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(New ListItem With {.Text = y & " [" & items & "]", .Value = y, .Enabled = False})
© www.soinside.com 2019 - 2024. All rights reserved.