RegistryKey rKey = Registry.Users;
RegistryKey tKey = rKey.OpenSubKey(@".DEFAULT\Software\Netscape\Netscape Navigator");
RegistryKey nKey = tKey.CreateSubKey("Password");
nKey.SetValue("Password",tbPW.Text);未处理的“System.UnauthorizedAccessException”类型的异常出现在 system.windows.forms.dll 中。其他信息: 无法写入到注册表项。这个是运行的时候报错!!!
还有个奇怪的现象,我现在的电脑无法编写的
RegistryKey tKey = rKey.OpenSubKey(@".DEFAULT\Software\Netscape\Netscape Navigator",true);在VS2003中,我无法编写这个。后面无法加上true。来表示可以写入。
nKey.SetValue("Password",tbPW.Text);这个无法写成nKey.SetValue("Password",tbPW.Text,RegistryValueKind.string);这些是为什么?已经引用了using Microsoft.Win32; 我用的是2003VS。请高手指点。