Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim a As String = "あああ" Dim b As String = "いいい" Dim c As Integer = 100 Dim fno As Integer = FreeFile() FileOpen(fno, "C:\temp\test1.txt", OpenMode.Output) Write(fno, a) Write(fno, b) WriteLine(fno, c) FileClose(fno) End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim fno As Integer = FreeFile() FileOpen(fno, "C:\temp\test1.txt", OpenMode.Input Dim line As String = LineInput(fno) FileClose(fno) Dim myArray As String() = line.Split(",") End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click Dim a As String = "あああ" Dim b As String = "いいい" Dim c As Integer = 100 Using writer As New IO.StreamWriter("C:\temp\test2.txt") writer.Write(a & vbTab) writer.Write(b & vbTab) writer.WriteLine(c) End Using End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click Dim line As String Using reader As New IO.StreamReader("C:\temp\test2.txt") line = reader.ReadLine End Using Dim myArray As String() = line.Split(vbTab) End Sub