将注册表编辑器中某自定义"键"的Value属性设为[TARGETDIR]

解决方案 »

  1.   

    jointan:
    你知道在代码中将某变量的值,写入注册表键值的方法吗?
      

  2.   

    Microsoft.Win32.RegistryKey softKey=Registry.LocalMachine.OpenSubKey("SoftWare",true);
    Microsoft.Win32.RegistryKey subKey=softKey.CreateSubKey(Application.CompanyName+"\\" + Application.ProductName);
    subKey.SetValue("Path",Application.StartupPath);
      

  3.   

    jointan:
    我试了,好象不行。SetValue函数的第2个参数是object value型的。我用的是vs.net正式版。
      

  4.   

    字符串
    比如:
     string str1="aaaa";
    subKey.SetValue("Path",str1);
    在输代码时,下面出现红线,提示语法错误
      

  5.   

    我这里试没问题啊
    我的是开发环境v7.0.9486
    .Net v1.0.3705
      

  6.   

    jointan:
    The same as yours,thank you !