vb.net - 拆分列表框项目

vb.net - Split Listbox Items

我在尝试拆分列表框的某些元素时遇到问题...

所以我在做什么 :

问题是我不知道该怎么做... 我已经看到 this link and this one 但无法为我的项目更改它。

我知道一个 YouTube link 是 43 个字符。

所以我想做的是:

抱歉,如果有语法错误,英语不是我的母语。

在线评论

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    'put each item in the list box into an array
    Dim arrList() As String = ListBox1.Items.OfType(Of String).ToArray
    'Trim each item in the array to a length of 43 characters
    Dim arrURL() As String = (From url In arrList
                              Select url.Substring(0, 43)).ToArray
    'Add the array as a Range to the items collection of the second list box
    ListBox2.Items.AddRange(arrURL)
End Sub