Newbie Question

I apologize in advance if this is the wrong place to post this question. 
I am using VB.Net 2005  (expess) and am relatively new to Visual basic
and SQL 2005 (express) 

Anyway, I was going through a tutorial set (creating an RSS Reader),
and after completing basic code / form creation, it made me wonder if there was
a way to have the treeview facilitate the Channel/Folder/Item fields that I created in the Database.  If there is, how would I go about accomplishing this (or at least help with directing me where to get the instruction from).

Thanks in Advance,

John Petty



Answer this question

Newbie Question

  • AGPX

    Thank you very much. I think I can adapt that to the logic. 

  • Michael Ruminer

    I assume the structure you are going for is something like this

    Channel
      |-Folder
      |  |-Item
      |  |-Item
      |-Folder
      |  |-Item
    Channel
    ...

    and each of your records has an Item, Folder, and Channel field.  So what you can do is this (in not quite code).

    for each record
      channelNode = nothing
      for each node in treeview.nodes
        if node.name = record.Channel then
          channelNode = node
          exit for
        end if
      next
      if channelNode is nothing then
        channelNode = new TreeNode(record.Channel)
        treeview.nodes.add(channelNode)
      end if

      folderNode = nothing
      for each node in channelnode.nodes
        if node.name = record.field then
          folderNode = node
          exit for
        end if
      next
      if foldernode is nothing then
        foldernode = new treenode(record.field)
        channelnode.nodes.add(foldernode)
      end if

      foldernode.nodes.add(new TreeNode(record.item))
    next 'record


  • Newbie Question