vb.net动态数组如何使用?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim sr As IO.StreamReader
Dim x() As String
Dim i As Integer = 0
sr = IO.File.OpenText("c:\a.txt")
While sr.Peek <> -1
x(i) = sr.ReadLine()
i = i + 1
End While
sr.Close()
MsgBox(x(0)) '显行第第1行的内容
End Sub
我想把"a.txt"中的每一行内容读到数组x中,
运行时出错"
未处理的“System.NullReferenceException”类型的异常出现在 WindowsApplication16.exe 中
其他信息:未将对象引用设置到对象的实例。
"