Select a node after its created

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Rogers

    Select a node after its created

    How do you keep the selection on a newly created treenode?

    After I hit enter, the selection always go back to the first root
    node.


    TIA


  • =?Utf-8?B?TW9ydGVuIFdlbm5ldmlrIFtDIyBNVlBd?=

    #2
    RE: Select a node after its created

    Hi John,

    How do you create the node? Is this a window or web application?

    --
    Happy Coding!
    Morten Wennevik [C# MVP]


    "John Rogers" wrote:
    How do you keep the selection on a newly created treenode?
    >
    After I hit enter, the selection always go back to the first root
    node.
    >
    >
    TIA
    >
    >
    >

    Comment

    • John

      #3
      Re: Select a node after its created

      Hi,

      I am creating it from a popup menu.

      private void newCategoryTool StripMenuItem_C lick(object sender,
      EventArgs e)
      {
      TreeNode ParentNode = treeView1.Nodes .Add("New Category");
      }


      Thanks


      "Morten Wennevik [C# MVP]" <MortenWennevik @hotmail.comwro te in message
      news:BD2F38E3-148E-4390-8F5C-B064A8BAAE97@mi crosoft.com...
      Hi John,
      >
      How do you create the node? Is this a window or web application?
      >
      --
      Happy Coding!
      Morten Wennevik [C# MVP]
      >
      >
      "John Rogers" wrote:
      >
      >How do you keep the selection on a newly created treenode?
      >>
      >After I hit enter, the selection always go back to the first root
      >node.
      >>
      >>
      >TIA
      >>
      >>
      >>

      Comment

      • Marc Gravell

        #4
        Re: Select a node after its created

        All you need is:
        treeView1.Selec tedNode = newNode;

        Marc

        Comment

        • John

          #5
          Re: Select a node after its created

          Thanks Marc,

          I had tried the following but I couldn't get it to work.
          treeView1.Selec tedNode = e.Node;

          I will see what messing it up.

          Thanks again



          "Marc Gravell" <marc.gravell@g mail.comwrote in message
          news:f2228d5d-ea5c-47a0-9d1f-9230539982b3@m3 6g2000hse.googl egroups.com...
          All you need is:
          treeView1.Selec tedNode = newNode;
          >
          Marc

          Comment

          • Marc Gravell

            #6
            Re: Select a node after its created

            Are you rebuilding the node tree at all?

            Comment

            • John

              #7
              Re: Select a node after its created

              No, no rebuilding. I am not too worried about it right now,
              I was just wondering if I was on the right track. I will have
              to put in on the todo list I guess :)

              Appreciate the help.


              John


              "Marc Gravell" <marc.gravell@g mail.comwrote in message
              news:762eeb3f-77f4-4a03-a0a8-2ca64aabb84b@h2 5g2000hsf.googl egroups.com...
              Are you rebuilding the node tree at all?

              Comment

              Working...