逆风方向 發表於 2017-3-27 10:47:31

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

<p>本文实例讲述了vb.net操作注册表的方法。分享给大家供大家参考,具体如下:</p>
<p>增加:</p>
<div class="jb51code">
<pre class="brush:vb;">
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)

</pre>
</div>
<p>修改:</p>
<div class="jb51code">
<pre class="brush:vb;">
Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software/Faxturer", True)
reg.SetValue("path", "d:/software/sdf", Microsoft.Win32.RegistryValueKind.String)

</pre>
</div>
<p>删除:</p>
<div class="jb51code">
<pre class="brush:vb;">
Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software/Faxturer", True)
key.DeleteSubKey("Manu")

</pre>
</div>
<p>查询:</p>
<div class="jb51code">
<pre class="brush:vb;">
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"))‘注册表子结点

</pre>
</div>
<p>希望本文所述对大家vb.net程序设计有所帮助。</p>
                           
                            <div class="art_xg">
                              <b>您可能感兴趣的文章:</b><ul><li>VB.net 查询获取数据库数据信息</li><li>C#/VB.NET 在PDF中添加文件包(Portfolio)的方法</li><li>VB.NET调用MySQL存储过程并获得返回值的方法</li><li>在VB.NET应用中使用MySQL的方法</li><li>VB.NET获取文件默认图标的方法</li><li>VB.NET校验字符串函数</li><li>C#、vb.net及SQL判断指定年份是否为闰年的方法</li><li>C#中的除法运算符与VB.NET中的除法运算符</li><li>浅谈如何使用vb.net从数据库中提取数据</li></ul>
                            </div>

                        </div>
                        <!--endmain-->
頁: [1]
查看完整版本: vb.net操作注册表的方法分析【增加,修改,删除,查询】