Generate XPathExpression from TreeView in C# OR Remember what user picked in TreeView

Generate XPathExpression from TreeView in C# OR Remember what user picked in TreeView

Post by Dave » Sat, 20 Dec 2008 05:24:59


I have what I thought would be a simple problem. I display some XML
data to a user in a TreeView (WindowsForms C# 2008). I'd like to
record what the user picked so I can highlight that choice next time.

I thought I'd be able to do something like:
TreeNode nd = treeView1.SelectedNode;
string savedValue = nd.FullPath;

Then, the next time around, I thought I could do something like this:

XPathNavigator nav1 = dom.CreateNavigator();
nav1 = nav1.SelectSingleNode(savedValue);

But this does not seem to work. An error is thrown on the
SelectSingleNode. Clearly I'm missing some basics, like how to
generate XPathExpressions, and the correct use of SelectSingleNode.

Can someone get me started?

Many thanks,


1. Can I get native code add-ins when I development the add-ins using C#?

2. Excel add-ins does not show up in Excel>Tools>Add-ins list.

Hi everybody,

I am trying to create an add-ins for Microsoft Excel using C#.

I started with Microsoft's article 302901 - How To Build an Office COM
Add-in by Using Visual C# .NET ://

The sample and documentation are nice to start with, but I cannot manage to
have exactly the behaviour I want.

The sample add-ins automatically loads when I start the Excel application.

This is done by setting the registry value
to 3 which is a combination of 1=Connected and 2=Bootload, as the
documentation states.

What if I want my add-ins to show-up in Tools>Add-Ins and be loaded when the
user selects it (just like "Analysis ToolPak", "Solver Add-In", "Lookup
Wizard" etc ?

Any help would be appreciated.

Thank you


3. Can only remove add-ins but cannot add add-ins in Outlook 2003 anymore

4. Visio Tools? Add-Ins, Plug-Ins, etc.

5. Solver in add-ins folder, but not in add-ins under tools menu

6. Check Browser Object Plug-ins/Add-ins

7. Schedule an email without plug-ins or add-ins?

8. WIN XP SP2 active X controls, plug ins, add ins, downloading s

9. Microsoft Access 2000 - Why are the add-ins greyed out after ins

10. Com add-ins versus normal add-ins?

11. GalCiv trade-ins vs MOO3 trade-ins.

12. Ins PA w/Life Ins sw such as Cyberlife, Vantage, Life70, etc. Contract to Hire Perm

13. Better Graph Add-ins/Plug-ins

14. Add-ins do not show up in the Add-Ins Ribbon

15. Disabling Add-Ins, plug ins