Hi

I am currently writing code to read and write certain labels and textboxes.

The code for the save button works fine:

Dim savef As New System.IO.StreamWriter("c:/text.txt")
       Text savef.Write(TextBox1.Text + ControlChars.NewLine + Textbox2.Text + controlChars.NewLine + label2.Text)
        savef.Close()

I need to have a load feature, here is my start but i am confused and need someone to complete the code for me, so textbox1 has line 1's value in it and line 2 textbox 2 etc:

Dim loadf As New System.IO.StreamReader("c:/text.txt")
        loadf.ReadLine(1)
        loadf.Close()

HELP PLEASE THIS IS URGENT

THANKS,
LUKE

Hi, ReadLine () return a line from the Stream. you can use like this

Dim loadf As New System.IO.StreamReader("c:/text.txt")
        TextBox1.Text = loadf.ReadLine()
        TextBox2.Text = loadf.ReadLine()
        Label2.Text = loadf.ReadLine()
        loadf.Close()
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.