C# 写入和读取地址到注册表 请教一个问题,我想通过菜单调用一个exe文件,先通过对话框设置它的地址,请问怎么把这个地址写入注册表再将其读到程序里去呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 2L的代码不错,应该能满足LZ的需要了 using Microsoft.Win32; //引入命名空间string path=@"C:\test.exe"; //你的exe文件路径写入注册表Registry.SetValue("HKEY_CURRENT_USER\\SubPath", "Path", path);读取object objPath = Registry.GetValue("HKEY_CURRENT_USER\\SubPath", "Path", null); if (objDailySend != null) //存在路径值则读取 { string path = objPath.ToString(); } crosoft.Win32; //引入命名空间string path=@"C:\test.exe"; //你的exe文件路径写入注册表Registry.SetValue("HKEY_CURRENT_USER\\SubPath", "Path", path);读取object objPath = Registry.GetValue("HKEY_CURRENT_USER\\SubPath", "Path", null); if (objDailySend != null) //存在路径值则读取 { string path = objPath.ToString(); } RegistryKey reg= Registry.LocalMachine;RegistryKey key= reg.OpenSubKey("",true); key.SetValue("", ""); private string GetRegistData(string name) { RegistryKey lm= Registry.LocalMachine; RegistryKey software = lm.OpenSubKey("SOFTWARE",true); RegistryKey k= software.OpenSubKey("",true); string registData = k.GetValue(name).ToString(); return registData; } C# WPF 使用图片做为控件 c#属性和索引器 关于UML udp问题,思归,速马,mvp统统帮我啊 编译c#的时候出现问题 非常单的问题,刚学C# 关于C#IIS问题 WCF转发问题 聊天室中,Remoting客户端第二次登录无法收到消息 请问, 我新建了一个*.cs文件,里面写了一个类,我如何在主窗体using它,谢谢:) winform里如何获取checklistbox里面选中的项 C#更新数据库出现问题,请高人指点,谢谢!
写入注册表
Registry.SetValue("HKEY_CURRENT_USER\\SubPath", "Path", path);读取
object objPath = Registry.GetValue("HKEY_CURRENT_USER\\SubPath", "Path", null);
if (objDailySend != null) //存在路径值则读取
{
string path = objPath.ToString();
}
写入注册表
Registry.SetValue("HKEY_CURRENT_USER\\SubPath", "Path", path);读取
object objPath = Registry.GetValue("HKEY_CURRENT_USER\\SubPath", "Path", null);
if (objDailySend != null) //存在路径值则读取
{
string path = objPath.ToString();
}
RegistryKey key= reg.OpenSubKey("",true);
key.SetValue("", ""); private string GetRegistData(string name)
{
RegistryKey lm= Registry.LocalMachine;
RegistryKey software = lm.OpenSubKey("SOFTWARE",true);
RegistryKey k= software.OpenSubKey("",true);
string registData = k.GetValue(name).ToString();
return registData;
}