[VB 2008] Select a TreeView Node

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?dmlubw==?=

    [VB 2008] Select a TreeView Node

    Hello

    I have created a TreeView and i wish to select a node into it
    and then expand the selected node.

    Is someone has an idea ?

    Thanks
  • Mattias Sjögren

    #2
    Re: [VB 2008] Select a TreeView Node

    >I have created a TreeView and i wish to select a node into it
    >and then expand the selected node.
    >
    >Is someone has an idea ?
    Assuming you mean a WinForms TreeView control:

    yourTreeView.Se lectedNode = ...
    yourTreeView.Se lectedNode.Expa nd()


    Mattias

    --
    Mattias Sjögren [C# MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

    Comment

    • =?Utf-8?B?dmlubw==?=

      #3
      Re: [VB 2008] Select a TreeView Node

      Hi Mattias and thank you for your answer.

      But the SelectedNode doesn't select the Node like a user click on it (with a
      blue bgcolor)
      Is there a solution to do it automatically without setting its BackColor
      property to Blue ?

      Comment

      • =?Utf-8?B?dmlubw==?=

        #4
        Re: [VB 2008] Select a TreeView Node

        Thanks Kadaitcha Man
        but it is not really what i want.

        When i write MyTreeView.Sele ctedNode = myNode, i want the selected Node
        myNode is like when we click on it, with the blue bgcolor.


        If you have code in the AfterSelect event handler that you want to execute
        when you select a node via code then move all the code out of the
        AfterSelect handler into another routine. Call the routine from the
        AfterSelect handler and call it when you set the SelectedNode in code.

        Comment

        • Herfried K. Wagner [MVP]

          #5
          Re: [VB 2008] Select a TreeView Node

          "vino" <alex_vino@disc ussions.microso ft.comschrieb:
          But the SelectedNode doesn't select the Node like a user click on it (with
          a
          blue bgcolor)
          Is there a solution to do it automatically without setting its BackColor
          property to Blue ?
          \\\
          Me.TreeView1.Se lectedNode = ...
          Me.TreeView1.Fo cus()
          ///

          Take a look at the 'HideSelection' property too.

          --
          M S Herfried K. Wagner
          M V P <URL:http://dotnet.mvps.org/>
          V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

          Comment

          • =?Utf-8?B?dmlubw==?=

            #6
            Re: [VB 2008] Select a TreeView Node

            Thank you very much Herfried,
            it's exactely what i want.


            "Herfried K. Wagner [MVP]" wrote:

            \\\
            Me.TreeView1.Se lectedNode = ...
            Me.TreeView1.Fo cus()
            ///
            >
            Take a look at the 'HideSelection' property too.
            >
            --
            M S Herfried K. Wagner
            M V P <URL:http://dotnet.mvps.org/>
            V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
            >
            >

            Comment

            Working...