Hi,

The code shown below sucessfully saves text onto a line in a txt document, but using the array, I want to be able to save each piece of text on a separate line. How would I do this?

Thanks in advance :)

Dim filePath As String
Dim objectWriter As StreamWriter
Dim text(3) As String
Dim int As Integer

Sub Main()

    filePath = "C:\College.txt"
    objectWriter = New StreamWriter(filePath)



    For int = 0 To 3
        Console.Write("Enter something here: ")
        text(int) = Console.ReadLine


        objectWriter.Write(text(int))


    Next
    objectWriter.Close()
    Console.WriteLine("Text has been saved.")

        Console.ReadLine()

End Sub

Use writeLine instead of write. That will add a line terminator to each line.

Thanks, worked perfectly :).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.