troubleshooting Question

Previous butoon click takes focus to previous sibling node not the last childnode of the previous node.

Avatar of RekhaShah
RekhaShah asked on
Node.js* TreeViewC#Microsoft Visual StudioJavaScript
2 Comments1 Solution22 ViewsLast Modified:
I have a treeview control and a tab control  on my winform and using C# in Visual Studio 2019.
I am trying to move up and down the treeview nodes by clicking Next and Previous button on each page of the tabcontrol.
I am using Inputsimulator from Nuget also.
My treeview node as 3 levels,Root, Nodes and nodes children.
     Node 1 TypeA(1)
     Node 2 TypeA(2)
     Node 5 B
     Node 6 B)
          Child 1
          Child 2
     Node 7 B
          Child 1
          Child 2
   Node 8 B

   private void btnPrevious_CPU_Click(object sender, EventArgs e)

            string CurrentnodeName = trvwBDA.SelectedNode.Name;


            string sNodeName;
            TreeNode TN;

            if (trvwBDA.SelectedNode.PrevNode == null)
            { TN = trvwBDA.SelectedNode.Parent; }
                TN = trvwBDA.SelectedNode.PrevNode;
            InputSimulator sim = new InputSimulator();
            HandleTreevoewNodeClick(TN, out sNodeName);

I am trying to move up and down the treeview nodes with Next-Previous button.. If i dont call SavePageContent routine( that is if treeview does not lose focus and does not get rreloaded, it works just fine. but when i try to come back to the treeview to the previously saved node, on "Previous" click, it goes to previous sibling node instead last child of the previous node. in this example, if i click  on Node 8B, it goes not Node 7B instead of Child 2 of Node 7B,  How do i fix it? i spend so much time on this, i give up.
Please hlep
Thanks in advance.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros