将数组插入Combobox

时间:2016-10-05 11:04:03

标签: vb.net visual-studio combobox split

Private Sub Form2_Load(sender As Object, e As EventArgs) Handles Me.Load
    Dim window As New System.IO.StreamReader("Pfad", True)
    Dim lines As String
    Dim Element As String()
    Dim SplitArray As String()
    lines = window.ReadToEnd
    Element = lines.Split("!")
    Element.Count


    For i = 0 To Element.Count - 1
        SplitArray = Element(i).Split(Chr(13))
    Next

    ComboBox1.Items.Add(SplitArray)

End Sub

您好我是新手。我想用我的Combobox填充拆分的结果。

1 个答案:

答案 0 :(得分:2)

使用addrange使用字符串数组填充组合框项目

ComboBox1.Items.AddRange(SplitArray)