Home All Groups Group Topic Archive Search About
Author
16 Apr 2006 10:44 PM
Jonny
Hi All

I am writing a small app that enumerates a certain registry key & then adds
the key values to a listbox

When I select one in the listbox & click the delete button I want to delete
that item from the registry

Example:

Some Key In Registry:

SubKey1     Value = "Hello"
SubKey2     Value = "Bye"
SubKey3     Value = "Cheap"
SubKey4     Value = "Expensive"
SubKey5     Value = "LOL"

So, the values Hello, Bye, Cheap, Expensive & LOL are shown in the lisbox,
but I cannot delete a key according to that value as it don't exist. So, if
I clicked on CHEAP how do I delete the entire SubKey3 from the registry?

Any help would be wonderful

TIA

Author
17 Apr 2006 2:00 AM
tomb
Jonny wrote:

Show quoteHide quote
>Hi All
>
>I am writing a small app that enumerates a certain registry key & then adds
>the key values to a listbox
>
>When I select one in the listbox & click the delete button I want to delete
>that item from the registry
>
>Example:
>
>Some Key In Registry:
>
>SubKey1     Value = "Hello"
>SubKey2     Value = "Bye"
>SubKey3     Value = "Cheap"
>SubKey4     Value = "Expensive"
>SubKey5     Value = "LOL"
>
>So, the values Hello, Bye, Cheap, Expensive & LOL are shown in the lisbox,
>but I cannot delete a key according to that value as it don't exist. So, if
>I clicked on CHEAP how do I delete the entire SubKey3 from the registry?
>
>Any help would be wonderful
>
>TIA
>
>

>
You need to hold a reference to SubKey3 in the list of values.  You have
a display member ( Cheap ) and a value member ( SubKey3 ), but you'll
have to bind the listbox to a table or arraylist or some such thing. 
Then when Cheap is selected for deletion, you can then delete SubKey3.

Tom