我有几个输入框,我想将所有这些值存储在二维数组中,然后全部写入 txt 文件,这是因为我想知道值的 i,j。因此,如果我进行一些更改,我只会看一下这个数组,那么如何在 txt 文件中插入一个数组呢?
我在做
Dim mArray(100,100) As String
mArray(0,0) = Textbox1.Text
mArray(0,1) = Textbox2.Text
...
Dim objWriter As New System.IO.StreamWriter("c:\file.txt", False)
objWriter.WriteLine(mArray)
objWriter.Close()
还是这样做会更好:
Dim objWriter As New System.IO.StreamWriter("c:\file.txt", False)
objWriter.WriteLine(Textbox1.Text)
objWriter.WriteLine(Textbox2.Text)
objWriter.WriteLine(Textbox3.Text)
objWriter.WriteLine(Textbox4.Text)
...
objWriter.WriteLine(Textboxn.Text)
objWriter.Close()