Quote Originally Posted by met0555 View Post
I would like to use a simple textfile.
There are probably 100 different ways to do it, for just two string variables I probably wouldn't bother getting too fancy and just use some basic stuff , something like this,,

Code:
Public Class Form1
    ' store title & url. 
    Private websiteURL As String
    Private websiteTitle As String
    ' path & filename where data is stored
    Private websiteFilename As String = IO.Path.Combine(Application.StartupPath, "website.txt")

    ' Test Data Load:
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        ' get saved data, returns true if data file found. 
        If LoadWebsiteData() Then ' show results in msgbox
            MessageBox.Show(websiteURL, websiteTitle)
        Else
            MessageBox.Show("No data file found")
        End If
    End Sub

    ' Test Data Save:
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        ' Set variables to something
        websiteTitle = "Visual Basic .NET"
        websiteURL = "http://www.vbforums.com/forumdisplay.php?25-Visual-Basic-NET"
        ' save the data, returns false if file save failed!
        If SaveWebsiteData() Then
            MessageBox.Show("File saved successfully!")
        End If
    End Sub

    Private Function LoadWebsiteData() As Boolean
        If IO.File.Exists(websiteFilename) Then
            Dim s() As String = IO.File.ReadAllText(websiteFilename).Split(CChar(vbTab))
            websiteTitle = s(0)
            websiteURL = s(1)
            Return True
        End If
        Return False
    End Function

    Private Function SaveWebsiteData() As Boolean
        Try
            IO.File.WriteAllText(websiteFilename, websiteTitle & vbTab & websiteURL)
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Return False
        End Try
        Return True
    End Function

End Class