I am working on building a web browser for my program and I have been trying to add a way for the user to add their own favorites. So I have a place where they click Add to Favorites and they are asked for the url of the site they want to add, then it is added to a .dat file, here is the code used for saving the favorites:
and here is the code that I have to load the favorites into a listbox:
Now the problem is that its not loading anything into the listbox.. anyone see a problem with any of that code?
Thanks
Code:
Saves favorites url to file
Dim sw As System.IO.StreamWriter = _
New System.IO.StreamWriter(Application.StartupPath & "\Sidekick Files\Settings\Favorites.dat", True)
Try
sw.WriteLine(MyFavoritesURL & vbTab & MyFavoritesURL)
sw.Flush()
Catch ex As Exception
MsgBox(ex.ToString, MsgBoxStyle.Exclamation, "Error saving new favorites URL. Please contact developer.")
Finally
sw.Close()
sw = Nothing
End Try
MessageBox.Show("My Favorites URL Successfully Saved!")
and here is the code that I have to load the favorites into a listbox:
Code:
Loads Favorites into listbox
Dim MyFavoritesURL As String
Dim sr As System.IO.StreamReader = _
New System.IO.StreamReader(Application.StartupPath & "\Sidekick Files\Settings\Favorites.dat")
Dim line, vals() As String
Do
line = sr.ReadLine
If line Is Nothing Then Exit Do
vals = line.Split(vbTab)
If vals(0) = MyFavoritesURL Then
lbFavorites.Items.Add(vals(1))
End If
Loop
sr.Close()
sr = Nothing
Now the problem is that its not loading anything into the listbox.. anyone see a problem with any of that code?
Thanks