当前位置:编程学习 > C#/ASP.NET >>

怎样删除注册标的健值,谢谢

如题
谢谢 --------------------编程问答-------------------- http://www.vs2005.com/CSharp-VB.NET/a488p1.aspx --------------------编程问答-------------------- 不行啊
报错 --------------------编程问答-------------------- 举个例子,删除run下的开机自动运行程序a.exe --------------------编程问答--------------------  RegistryKey mykey =Registry.LocalMachine.OpenSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion",true); 
                RegistryKey mykeydel = mykey.OpenSubKey("Run");
             
                string strname = "StartCopy";

                mykeydel.DeleteValue(strname);
报错!“未将对象的引用设置到对象的实例”!

--------------------编程问答-------------------- 那个“未将对象的引用设置到对象的实例”?mykeydel   ? --------------------编程问答-------------------- 无语。 --------------------编程问答-------------------- 用了Registry.LocalMachine,就不要用HKEY_LOCAL_MACHINE\ --------------------编程问答--------------------

RegistryKey   mykeydel   =   mykey.OpenSubKey("Run"); //要改成可写的,mykey.OpenSubKey("Run",true)




补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,