C#读取注册表的值时揭示“未将对象实例化”
C#读取注册表的值时提示“未将对象实例化”[解决办法]RegistryKey delKey Registry.LocalMachine.OpenSubK
C#读取注册表的值时提示“未将对象实例化”
[解决办法]RegistryKey delKey = Registry.LocalMachine.OpenSubKey(path, true);
if (delKey == null) {
MessageBox.Show("键值不存在");
return;
}
try {
string?ad?=?delKey.GetValue("PortName").ToString();
//...
[解决办法]delKey可能是NULL
[解决办法]最好的办法--调试..
[解决办法]学会调试和调查