Hi guys , how can i save some texts from textboxes into a word in a listbox so when i will reopen the program i will continue having the save?

Regards,
xVent.

Recommended Answers

All 4 Replies

you can either save it in My.Settings or create a xml/text file to hole the data.

You need to save the values on an external file(Settings.txt)

the problem is that i dont know the way to do it.

-xVent

just a small example:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        My.Computer.FileSystem.WriteAllText("myText.txt", TextBox1.Text & "#", True)
        ListBox1.Items.Add(TextBox1.Text)
        TextBox1.Clear()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            For Each line As String In My.Computer.FileSystem.ReadAllText("myText.txt").Split("#")
                ListBox1.Items.Add(line)
            Next
        Catch ex As system.IO.FileNotFoundException
            'file doesnt exist yet
        End Try
    End Sub
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.