Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Treeview Selected Node

Treeview Selected Node

Scheduled Pinned Locked Moved Visual Basic
question
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ejaz_pk
    wrote on last edited by
    #1

    I have treeview and 2 listview on my form.And there is one menu with text multiple windows.If the multiplewindows menu is checked and 2nd listview.items.count > 1 then I am using the following lines to open a new window of the same form. Dim newform as new frmscore newform.show Now I want to select the same treeview node on the new form which is selected on the form frmscore.And the same item should be selected on the new form which is selected on the form frmscore(First Window). How I can solve this? Thanks In Advance. Ejaz

    D 1 Reply Last reply
    0
    • E ejaz_pk

      I have treeview and 2 listview on my form.And there is one menu with text multiple windows.If the multiplewindows menu is checked and 2nd listview.items.count > 1 then I am using the following lines to open a new window of the same form. Dim newform as new frmscore newform.show Now I want to select the same treeview node on the new form which is selected on the form frmscore.And the same item should be selected on the new form which is selected on the form frmscore(First Window). How I can solve this? Thanks In Advance. Ejaz

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Expose a public method on your second form (frmscore) that finds and selects the item you pass in from the original form.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      E 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Expose a public method on your second form (frmscore) that finds and selects the item you pass in from the original form.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        E Offline
        E Offline
        ejaz_pk
        wrote on last edited by
        #3

        Thanks Dave for ur reply. I tried to store the fullpath value of the original form in the variable and then expand the nodes of treeview on the new form and try to find the node with the same path but it is not working.How I can use the full path in loop to check all the nodes of the new form with the same path and if found then select that node. Any Idea how to solve this. Ejaz

        D 1 Reply Last reply
        0
        • E ejaz_pk

          Thanks Dave for ur reply. I tried to store the fullpath value of the original form in the variable and then expand the nodes of treeview on the new form and try to find the node with the same path but it is not working.How I can use the full path in loop to check all the nodes of the new form with the same path and if found then select that node. Any Idea how to solve this. Ejaz

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Get the parent of the selected node and add it to a list. Get the parent of that node, add it to the list. Get the parent of that node, add it to the list... Until there are no more parents. You pass this list to the other form. Now, in reverse order, you can build and open the path to the node you're looking for.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          R 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Get the parent of the selected node and add it to a list. Get the parent of that node, add it to the list. Get the parent of that node, add it to the list... Until there are no more parents. You pass this list to the other form. Now, in reverse order, you can build and open the path to the node you're looking for.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            R Offline
            R Offline
            rama charan
            wrote on last edited by
            #5

            hi Can Anyone tell me what functions can help in doing this or how can this be achieved using code .. thanks ...

            Rama Charan Prasad "Be happy and Keep smiling.Thats what u want be always..:)"

            modified on Monday, December 17, 2007 11:07:29 AM

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups