0

I want to get name of the checkboxes in checkedlistbox control.

By this following code I am only able to get the Text associated with the checkboxes :

    Dim sb As New System.Text.StringBuilder
    Dim CheckedList =
        (
          From Item In clbCheckedListBox.Items.Cast(Of String)() _
          .Where(Function(xItem, Index) clbCheckedListBox.GetItemChecked(Index))
          Select Item
        ).ToList

Example: I want chk_01 instead of Hello World

(checklistbox name = clbCheckedListBox
One of the checkbox name = chk_01
chk_01 checkbox contains text Hello World )

P.s. : I am getting Text of only checked checkboxes by the above code
(I want same but with the checkbox Name)

Please Help...Thanks In Advance..

4

3 に答える 3

0
Dim CheckedList =
        (
            From Name In clbCheckedListBox.CheckedIndices.Cast(Of Integer)() _
            .Where(Function(xItem, Index) clbCheckedListBox.GetItemChecked(Index))
            Select Name
        ).ToList

変更点:
clbCheckedListBox.CheckedIndices.Cast(Of Integer)

于 2013-07-26T15:23:43.120 に答える
0

プロパティを参照してclbCheckedListBox.ID、コントロールの一意の ID を取得できると思います。

また、興味のある UniqueID プロパティと TagName もあります。

ここで問題になる可能性があるという事実.Cast(Of String)()は、提案していることを実行するには完全な cehckbox オブジェクトが必要になることです

于 2013-07-26T14:36:33.293 に答える