How do I load the URLs of all favourites in the Favourites file?

How do I load the URLs of all favourites in the Favourites file and ho

Page 1 of 1

1 Replies - 1054 Views - Last Post: 06 April 2009 - 02:51 PM Rate Topic: ***** 1 Votes

#1 Jack Eagles1  Icon User is offline

  • Pugnacious Penguin (inspired by no2pencil)
  • member icon

Reputation: 183
  • View blog
  • Posts: 1,152
  • Joined: 10-December 08

How do I load the URLs of all favourites in the Favourites file?

Post icon  Posted 06 April 2009 - 08:38 AM

How do I load the URLs of all favourites in the Favourites file and how do I make favourites in the file? This is the code I have:
Public Class Form1


	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Dim favouriteFiles() As String = System.IO.Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.Favorites), "*.url")
		For Each currentFile As String In favouriteFiles
			Me.ComboBox1.Items.Add(currentFile)
		Next
		For Each item In ListBox1.Items
			Dim loadf As New System.IO.StreamReader(ComboBox1.Text)
			ListBox1.Items.Add(loadf.ReadLine)
		Next
	End Sub
End Class





Thanks in advance for any help

---- JackEagles

Is This A Good Question/Topic? 0
  • +

Replies To: How do I load the URLs of all favourites in the Favourites file?

#2 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2262
  • View blog
  • Posts: 9,464
  • Joined: 29-May 08

Re: How do I load the URLs of all favourites in the Favourites file?

Posted 06 April 2009 - 02:51 PM

What about this?
 Dim fl As New List(Of String)
  For Each f As String In System.IO.Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.Favorites), "*.url")
   fl.Add(System.Text.RegularExpressions.Regex.Match(My.Computer.FileSystem.ReadAllText(f), "URL=(.*?)\sID").Groups(1).Value)
  Next


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1