I'm trying to get the value of a registry sub-key that I know exists. The code I'm using is:
private void button11_Click(object sender, EventArgs e) { try { RegistryKey newKey = Registry.LocalMachine; newKey = newKey.OpenSubKey(@"\SOFTWARE\CyberLink\PowerDVD21"); string loc = newKey.GetValue("OpenWithMUI").ToString(); newKey.Close(); MessageBox.Show("Main Dir: " + loc); } catch(Exception ex) { MessageBox.Show(ex.ToString(),"ERROR",MessageBoxButtons.OK,MessageBoxIcon.Error); } }
When I click on the button that the code is attached to, I get this:
When I did research, it looked like what I was doing was correct. So what am I doing wrong?
Thanks for the help.