刚刚在微博上看到的一道题:在vb.net中如何用二维数组逐个的把TEXTBox文本框里面的数字读取?数字如下:
0 1 2 3
1 2 3 4
2 3 4 5
3 4 5 6
参照这个题目,自己写了下代码(先将TEXTBox的MultiLine 勾选)
Try Dim arry1(,) As Integer Dim i%,j% j = TextBox1.Lines.Count For m As Integer = 0 To j - 1 i = UBound(Split(TextBox1.Lines(m)," ")) ReDim Preserve arry1(j,i) For n As Integer = 0 To i arry1(m,n) = Split(TextBox1.Lines(m).ToString," ")(n) Next Next 'For test MsgBox(arry1(3,3)) Catch ex As Exception MessageBox.Show(ex.Message) End Try