Click here to Skip to main content
15,925,371 members
Home / Discussions / C#
   

C#

 
GeneralRe: Default parameters in C# method Pin
Christian Graus20-Oct-05 12:49
protectorChristian Graus20-Oct-05 12:49 
GeneralRe: Default parameters in C# method Pin
PaulPrice23-Jul-07 9:50
PaulPrice23-Jul-07 9:50 
AnswerRe: Default parameters in C# method Pin
Ali Beirami21-Oct-05 3:00
Ali Beirami21-Oct-05 3:00 
QuestionCatastrophic Error Pin
NET_GEEK20-Oct-05 11:01
NET_GEEK20-Oct-05 11:01 
AnswerRe: Catastrophic Error Pin
Christian Graus20-Oct-05 12:03
protectorChristian Graus20-Oct-05 12:03 
GeneralRe: Catastrophic Error Pin
NET_GEEK20-Oct-05 17:59
NET_GEEK20-Oct-05 17:59 
GeneralRe: Catastrophic Error Pin
Christian Graus23-Oct-05 12:13
protectorChristian Graus23-Oct-05 12:13 
QuestionReading Registry Data Pin
TeamWild20-Oct-05 8:43
TeamWild20-Oct-05 8:43 
I am trying to find out the version numbers of the components that appear in the Add/Remove programs list.

The data I'm after is stored in the registry BUT I don't seem to be able to access it via code but I can view it usingg Regedit.

Below is the code I'm using to try and access the data. As you can see, I've tried setting the access permission but I'm not entirely sure if my implementation is correct.

If I trim the registry path down to "Software\\Microsoft\\Windows" I get a key returned.

Any ideas???

Cheers,
Ben

<code>
/// <summary>
/// Create a registry key object to allow us to retrieve installed components version numbers.
/// </summary>
/// <returns>The registry key to use if no error occured, else null</returns>
private RegistryKey GetRegistryKey()
{
RegistryKey sysSettingsKey = null;

try
{
// Setup permission to ccess the key
RegistryPermission f = new RegistryPermission(PermissionState.Unrestricted);
f.AddPathList(RegistryPermissionAccess.Read,
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall");

// Try and open the key to see if it exists
sysSettingsKey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\Current Version\\Uninstall");

// Was the key found?
if( sysSettingsKey == null )
{
MessageBox.Show("Unable to access the uninstalll information", "Registry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
catch(Exception ex)
{
MessageBox.Show(string.Format("Exception Detected: \n{0}",ex.ToString()),"Registry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
return sysSettingsKey;
}
</code>

-- modified at 14:43 Thursday 20th October, 2005
AnswerRe: Reading Registry Data Pin
Christian Graus20-Oct-05 10:40
protectorChristian Graus20-Oct-05 10:40 
GeneralRe: Reading Registry Data Pin
TeamWild20-Oct-05 23:14
TeamWild20-Oct-05 23:14 
Questionsplit a web service Pin
krism4220-Oct-05 8:27
krism4220-Oct-05 8:27 
AnswerRe: split a web service Pin
Matt Newman20-Oct-05 8:56
Matt Newman20-Oct-05 8:56 
GeneralRe: split a web service Pin
krism4220-Oct-05 9:02
krism4220-Oct-05 9:02 
AnswerRe: split a web service Pin
Tom Larsen20-Oct-05 11:20
Tom Larsen20-Oct-05 11:20 
GeneralRe: split a web service Pin
krism4220-Oct-05 11:23
krism4220-Oct-05 11:23 
GeneralRe: split a web service Pin
Tom Larsen20-Oct-05 11:48
Tom Larsen20-Oct-05 11:48 
GeneralRe: split a web service Pin
krism4220-Oct-05 12:31
krism4220-Oct-05 12:31 
QuestionGrid Drawing Pin
har04mich20-Oct-05 7:23
har04mich20-Oct-05 7:23 
QuestionRe: Grid Drawing Pin
MoustafaS20-Oct-05 7:27
MoustafaS20-Oct-05 7:27 
AnswerRe: Grid Drawing Pin
har04mich20-Oct-05 7:54
har04mich20-Oct-05 7:54 
GeneralRe: Grid Drawing Pin
Wjousts20-Oct-05 8:24
Wjousts20-Oct-05 8:24 
QuestionHelp with Structs Pin
JMichael246820-Oct-05 4:39
JMichael246820-Oct-05 4:39 
AnswerRe: Help with Structs Pin
S. Senthil Kumar20-Oct-05 4:59
S. Senthil Kumar20-Oct-05 4:59 
GeneralRe: Help with Structs Pin
JMichael246820-Oct-05 5:12
JMichael246820-Oct-05 5:12 
GeneralRe: Help with Structs Pin
JMichael246820-Oct-05 5:58
JMichael246820-Oct-05 5:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.