以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]获取CheckedListBox中选中项目的名称  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=173970)

--  作者:cqlwsam
--  发布时间:2021/12/24 15:42:00
--  [求助]获取CheckedListBox中选中项目的名称
窗口中有一个CheckedListBox控件,判断某项目已选中,如何获取选中项目的值,以便实时更新到文本框中。谢谢!

Dim cst As WinForm.CheckedListBox = e.Sender

Dim t As String = ""

For idx As Integer = 0 To cst.Items.Count - 1

    If cst.GetItemChecked(idx) Then

        t = t & "," & cst.SelectedValue

    End If

Next

t = t.remove(0,1)

e.Form.controls("TextBox1").value = t


--  作者:cqlwsam
--  发布时间:2021/12/24 15:53:00
--  
简单粗暴:
Dim cst As WinForm.CheckedListBox = e.sender
e.Form.controls("TextBox1").value = cst.Value