Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all,

 

I'm working on an XML reader program for our support team to make a "human readable" form of an XML file. I have the XML file that is generated from a program whenever a support request is sent. The XML file has a breakdown of the registry keys on the user's computer that are specific to the program. The file is structured as follows:

 

 

- <Registry>
- <RegistryKey>
 <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">HKEY_LOCAL_MACHINE\Software\Company Name</Name> 
 </RegistryKey>
- <RegistryKey>
 <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">HKEY_LOCAL_MACHINE\Software\Company Name\Program Name</Name> 
- <Property>
 <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">VersionMajor</Name> 
 <Value xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="int" regType="4">1</Value> 
 </Property>
- <Property>
 <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">VersionMinor</Name> 
 <Value xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="int" regType="4">2</Value> 
 </Property>
 </RegistryKey>
- <RegistryKey>
 <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">HKEY_LOCAL_MACHINE\Software\Company Name\Program Name\Version 1.2</Name> 
 </RegistryKey>
.
.
.
.
.

 

Now, I need to build a treeview that looks like the REGEDIT in Windows, but I'm having a hard time getting the nodes set up correctly. Basically what I need to do is read the NAME value that includes the registry key and determine if the correct nodes have been added to the treeview. If not, then I need to add the appropriate nodes.

 

This is where I'm running into problems. I've added the 5 root nodes into the node collection of the treeview control through the designer. But, when I go to add the "subnodes" at runtime, I just can't get them to display correctly. Later, I'll need to add the PROPERTY values from the XML file to a listview control so that when the user clicks on the node, it displays the property values in the listview.

 

Does anyone have an idea on how I can do this without writing multiple FOREACH and IF statements?

 

Thanks in advance,

 

Chris

if(computer.speed == "slow")
    {  
       hamster.feed();  
    }
if(computer.speed == "really slow")
    {  
        hamster.kill();
        BuyNewHamster();
    }

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...