索引超出数组范围

时间:2018-12-28 13:27:06

标签: vb.net

我得到了错误代码,索引了Oide数组的边界。如果输入“文本框”而不是“文本框(行)”,则代码将生效。接下来,我该怎么做才能在代码和行中工作?

    TextBox4.Text = System.IO.File.ReadAllText(Mydpi.Text)
    TextBox5.Text = TextBox4.Lines(0)
    TextBox6.Text = TextBox4.Lines(1)
    Dim firstBoxList = TextBox5.Text.Split(",").ToList()
    Dim secondBoxList = TextBox6.Text.Split(",").ToList()
    Dim intersectionList = firstBoxList.Intersect(secondBoxList)
    For Each str As String In intersectionList
        TextBox7.Text = TextBox5.Text & str & ","
    Next
    TextBox8.Text = intersectionList.Count()
    Dim notRepeatedCharacter = firstBoxList.Union(secondBoxList).ToList
    notRepeatedCharacter.RemoveAll(Function(x) intersectionList.Contains(x))
    For Each str As String In notRepeatedCharacter
        TextBox9.Text = TextBox9.Text & str & ","
    Next
    TextBox9.Text = notRepeatedCharacter.Count()
End Sub

0 个答案:

没有答案