【问题标题】:How do i concatenate uin of list of item i vb.net如果项目列表 i vb.net 我如何连接
【发布时间】:2011-12-20 21:22:32
【问题描述】:

我确实有一个多选下拉框。

我希望所有选定的项目都放在一个逗号分隔值的字符串中。

目前我正在做以下事情:

        Dim SelUINS As String = ""

        For Each Item As SalesCustomer In RetailerMainListBox.SelectedItems
            SelUINS += Item.Uin & ","
        Next
        SelUINS = Strings.Left(SelUINS, SelUINS.Length - 1)

我想要一个像 join 这样的快捷方式来完成任务。

【问题讨论】:

    标签: vb.net join concatenation


    【解决方案1】:

    这可能会有所帮助:

    Dim names As String = String.Join(", ", RetailerMainListBox.Items.Cast(Of Object)().Select(Function(i) i.Uin.ToString()))
    

    取自here

    【讨论】:

    • 很有帮助....虽然为了确切的结果我需要将 i.tostring 更改为 i.uin.tostring... :) thnx
    猜你喜欢
    • 2014-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多