Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deleting a key value from the registry on uninstall 1

Status
Not open for further replies.

steve1rm

Programmer
Joined
Aug 26, 2006
Messages
255
Location
GB
Hello

I am setting a key value in the system registry. However, I would like this removed when the user uninstalls the program.

The method I am using to set it is below:
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\CodeRedInstalled", "ITSolution", "Is Installed")

I have used window installer to install the program. However, when the uninstalls from the add remove program, I would like this key value to be deleted.

Is there anyway to do this?

Many thanks,

Steve
 
Where are you creating the registry key? What I mean is, are you creating the key in the application, or is it done during the installation? If it is done by the application, you should change it so that the registry key is created by the installation.

In your install project, look in the solution explorer and at the top there is a toolbar. When you select the install project (not the solution or the items under the install project), you should see several icons on the toolbar, one of which is the Registry Editor. Click on this button, and you should see the registry tree appear on the left. Drill down to the location where you want the key to reside, for example, HKLM/Software. Under that node you should see a node titled [Manufacturer]. Right-click on the [Manufacturer] node and select New->Key from the pop-up menu, and type in the name for the key. Now go back to the [Manufacturer] node, right-click and select 'Properties Window'. In the Properties Window, set the Manufacturer name, and also set the DeleteAtUninstall property to True. Note that this property also is available for any other keys you have set up for the install program to create. Setting DeleteAtUninstall to True does just that - the uninstall program should now remove the registry key when the program is removed.

If you need to set the registry key's value in your application, such as for a user setting, etc., that is okay. You can still create the key at install and have the app update the value to whatever it needs to be. Then the uninstall program will remove the key.

Hope this helps.


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
Hello jebenson,

Thanks for all that information. I gave you a tip.

I was creating the key value in the application. However, you way seems so much better.

Thanks very much for the advice.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top