0

试图让所有选定项目的结果显示在一个消息框字符串中。到目前为止我有这个,我知道这是错误的。如果重要,此列表将通过文本文件和对象填充。

Dim cBike As String = "
    For Each cBike In clbBikes.Items
        cBike = clbBikes.SelectedItem & ", "
    Next
    MsgBox(("Your selection of: " & cBike))

请帮助,我的讲师将永远帮助那些更需要它的人。

4

2 回答 2

0

您需要实际连接字符串:

For Each cBike In clbBikes.Items
    cBike = cBike + clbBikes.SelectedItem & ", "
Next

您还需要删除最后一个逗号

If (xml.Length > 2) Then
    cBike = cBike.Remove(cBike.Length - 2, 2)
End If
于 2013-11-12T03:48:39.427 回答
0

您可能的意思是CheckedItems

 Dim cBike As String = ""
 For Each chk As String In clbBikes.CheckedItems
    cBike &= chk & ", "
 Next

 MessageBox.Show("Your selection of: " & cBike)
于 2013-11-12T03:54:02.220 回答