how to import Bookmarks favorites file to treeview

hi
i'm export my favorites links from internet explorer as html file
now i want to import this ( html ) file to tree view on my form
i can read form this file and get folder name and URL but i cann't make it as tree it's now in on level only
i want to read from this file and make tree view in many level

can you help me
if you want to explanation pls tell me

 




Answer this question

how to import Bookmarks favorites file to treeview

  • Leon You

    ok

    thanks shakalama

    but the problem is stay

    your code i think it's for read favorets from ( favorets folder ) , but i want read from html file ( BookMarks )

    pls DownLoad Above Example or this ex

    http://www.segaaal.com/Read_Bookmark.zip

    it's contain part of solution , it read Url and Folder from html file ( BookMarks ) on one level but we want to read as tree on multi level

    any one can help us



  • princess275

    i'm also search for this code

    but i have an wxample it's show folder and url in bookmarks , but it's show in one level can any one help me to show in multi levle as tree

    this is my example

    http://www.segaaal.com/Read_Bookmark.zip

     


  • bsextonatl

    hi

    thanks shakalama

    i wait you to DownLoad Example and try it

    this part is important from my project

    thanks


  • Sam Wane

    lol

    ok its not your choice , you have 2 folders 1 inside another you can ask this which is not the case in your file, try to play with your favorites >> organize favorites >> add folder inside a folder and add some link and you will know why they have 3 levels

    more over why do you need someone to edit this example for you , would you hire him to work for you here you can just get direction not employees



  • Roopa

    hi,

    ok i guess saving your data in html page is not a good idea xml will be better anyway and will save you from all that pareing other wise you have to close your nodes like you use <p> without closeing it </p> and other tags also you don't close  anyway i took a look to that file and you will find the changes under todo coments


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If OpenFileDialog1.ShowDialog = DialogResult.OK Then

    TreeView1.Nodes.Clear()
    Dim strStartFolder As String = "<DT><H3 FOLDED ADD_DATE"

    Dim StartURL As String = "<DT><A HREF="

    Dim sw As New StreamReader(OpenFileDialog1.FileName, System.Text.Encoding.Default)
    Dim myline As String = sw.ReadLine
    'ToDo : flag to indecate the last folder

    Dim mylastfolder As TreeNode = Nothing

    While Not myline Is Nothing

    myline = sw.ReadLine
    If myline <> "" Then

    'if this line is folder name

    If myline.IndexOf(strStartFolder) > -1 Then

    Dim strNodeName As String = GetFolderName(myline)
    'ToDo : tree node

    Dim folder As New TreeNode
    folder.Text = strNodeName
    folder.Tag =
    "Folder"

    TreeView1.Nodes.Add(folder)
    'ToDo : change the folder

    mylastfolder = folder
    End If

    'if this line is file name

    If myline.IndexOf(StartURL) > -1 Then

    Dim strNodeName As String = GetHrefName(myline)
    'Todo : this is subfolder node

    Dim subfolder As New TreeNode
    Dim keys() As String = strNodeName.Split("-")
    subfolder.Text = keys(1)
    subfolder.Tag = keys(0)
    mylastfolder.Nodes.Add(subfolder)
    End If

    End If

    End While

    sw.Close()
    sw =
    Nothing

    End If

    End Sub

    Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
    'ToDo : if selected node is subfoldernode then open the link that stored in the tag

    If Not e.Node.Tag = "Folder" Then

    System.Diagnostics.Process.Start("iexplore.exe", e.Node.Tag)
    End If

    alf mabrouk 3ala el mawqe3 we rabina yewafaf2ak insha'allah 

    End Sub


     

    hope this helps



  • Shiby

    ok, just put folders inside each other and when you exporting your favorits select favorites node not subfolder at least to see what you want , the direction is text parseing the code that you have did 70% of the job  you just need to know when you go to subfolder and when you need to go to parent folder

    anyway like that if you have 100 folders inside each other you will get hundred levels


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If OpenFileDialog1.ShowDialog = DialogResult.OK Then

    TreeView1.Nodes.Clear()
    Dim strStartFolder As String = "<DT><H3 FOLDED ADD_DATE"

    Dim StartURL As String = "<DT><A HREF="

    Dim sw As New StreamReader(OpenFileDialog1.FileName, System.Text.Encoding.Default)
    Dim myline As String = Nothing

    'ToDo : flag to indecate the last folder

    Dim mylastfolder As TreeNode = Nothing

    While Not sw.EndOfStream
    myline = sw.ReadLine
    If myline <> "" Then

    'ToDo : close lastfolder this is the important part to have hierarchy nodes

    If myline.Trim() = "</DL><p>" Then

    If Not mylastfolder Is Nothing AndAlso mylastfolder.Level <> 0 Then

    mylastfolder = mylastfolder.Parent
    Else

    mylastfolder = Nothing

    End If

    End If

    'ToFo : the way of parseing that you use, uses much cycles more than it should

    'all your text that you want to add as treenodes starts by <DT>

    'if this line is folder name

    If myline.IndexOf(strStartFolder) > -1 Then

    Dim strNodeName As String = GetFolderName(myline)
    mylastfolder = addfolder(strNodeName, mylastfolder)
    End If

    'if this line is file name

    If myline.IndexOf(StartURL) > -1 Then

    Dim strNodeName As String = GetHrefName(myline)
    'Todo : this is subfolder node

    addlink(strNodeName, mylastfolder)
    End If

    End If

    End While

    sw.Close()
    sw =
    Nothing

    End If

    End Sub

    Private Function addfolder(ByVal name As String, ByVal parent As TreeNode) As TreeNode
    'ToDo : add folder node

    Dim node As New TreeNode
    node.Text = name
    node.Tag =
    "Folder"

    If parent Is Nothing Then

    TreeView1.Nodes.Add(node)
    Else

    parent.Nodes.Add(node)
    End If

    Return node
    End Function

    Private Sub addlink(ByVal strNodeName As String, ByVal parent As TreeNode)
    'ToDo: Add(link)

    Dim node As New TreeNode
    Dim keys() As String = strNodeName.Split("-")
    node.Text = keys(1)
    node.Tag = keys(0)
    If parent Is Nothing Then

    TreeView1.Nodes.Add(node)
    Else

    parent.Nodes.Add(node)
    End If

    End Sub

    Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
    'ToDo : if selected node is subfoldernode then open the link that stored in the tag

    If Not e.Node.Tag = "Folder" Then

    System.Diagnostics.Process.Start("iexplore.exe", e.Node.Tag)
    End If

    'alf mabrouk 3ala el mawqe3 we rabina yewafaf2ak insha'allah

    End Sub


     

    hope this helps



  • catherinejean

    hi,

    still doesn't work the page can't be displayed or the file doesn't exist



  • Lord Chabelo

    hi

    i'm very sorry to this mistake

    this is correct link

    http://www.segaal.com/Read_Bookmark.zip

    i hope any one download example get my any idea

    i'm beginning frist step and want help to finish problem

    thanks


  • pingping

    hi

    thanks shakalama for your code

    i cann't use XML file because i'm read favorites file from ie and in ie export my favorites as html file ( BookMarks ) so i must read from html file

    i'm get an example from vbcity but it not complet , this is example from vbcite

    http://www.segaal.com/ReadBookmark2.zip

    example read HTML file and consider it contain two level but in fact it's contain three level
    as this picture

    http://www.segaal.com/BookMarks_Level.jpg

    pls i want to edit this project to read HTML file in multi Level in tree view as above picture

    any one can edit this example to Read BookMarks by multi level in tree view

    http://www.segaal.com/ReadBookmark2.zip

    thanks for all


  • CWIZO

    up

  • TeLLTaLe

    lol ok i'm up now

    actualy i have tried to download this file but it didn't work yesterday nor today

    best regards



  • Vlad.S

    he has one to many "a"'s in segaaal in the link, try replacing with segaal

  • MS440

    thanks shakalama i'm know i'm here to get help not to get employees

    i'm existing try to solve this problem , and write above example but i can but i cann't read folder in inside folder and read url include in last folder

    i'm need any idea or code or direction to read this file

    thanks for all


  • John P Murphy

    hi,

    i assume that you want to make the parent nodes for the folders and the sub nodes for subfolder uri's , it will be something like that

    this part will be for folders in your favorits

    For Each folder In myfavoretsfolder

    NodeCat = New TreeNode

    NodeCat.Text = foldername

    TreeView1.Nodes.Add(NodeCat)

    For Each uri In folder

    NodeSubCat = New TreeNode

    NodeSubCat.Text = myURIshortcutName

    NodeSubCat.Tag = myURIshortcutURI

    NodeCat.Nodes.Add(NodeSubCat)

    Next

    Next

    this part will be for uris that is not catigorized in your favorits

    For Each uri In myfavoretsfolder

    NodeCat = New TreeNode

    NodeCat.Text = myURIshortcutName

    NodeCat.Tag = myURIshortcutURI

    TreeView1.Nodes.Add(NodeCat)

    hope this helps



  • how to import Bookmarks favorites file to treeview