编程开发 > DotNET > VB.Net > 文章内容

vb.net操作注册表的方法分析【增加,修改,删除,查询】

2017-8-7编辑:daibenhua

本文实例讲述了vb.net操作注册表的方法。分享给大家供大家参考,具体如下:

增加:

1
2
3
4
5
Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software/Faxturer", True)
Dim subkey As Microsoft.Win32.RegistryKey
subkey = key.CreateSubKey("Manu")
subkey.SetValue("Path", "d:/software/sdf", Microsoft.Win32.RegistryValueKind.String)
'reg.SetValue("path", New String() {"d:/software/sdf","dfdf"}, Microsoft.Win32.RegistryValueKind.MultiString)

修改:

1
2
Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software/Faxturer", True)
reg.SetValue("path", "d:/software/sdf", Microsoft.Win32.RegistryValueKind.String)

删除:

1
2
Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software/Faxturer", True)
key.DeleteSubKey("Manu")

查询:

1
2
3
4
5
6
Dim rk As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software/ManuFaxturer", True)
Dim s As String() = rk.GetSubKeyNames()
Dim subkey As Microsoft.Win32.RegistryKey
subkey = rk.OpenSubKey("Manu", False)
MsgBox(rk.GetValue("Path"))'注册表根节点
MsgBox(subkey.GetValue("Path"))‘注册表子结点

希望本文所述对大家vb.net程序设计有所帮助。

VB.NET实现的MD5加密算法示例【32位】

热点推荐

登录注册
触屏版电脑版网站地图