0

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.

3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by GeekByChoiCe
0

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

Edited by yorro: n/a

-1

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

-xVent

0

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
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.