通行证: 用户 密码 域名空间  下载中心 社区论坛 信息公告 MY小屋
联系我们
设为首页
加入收藏

 

QQ,ASP,PHP,JSP,XML,SQL,.Net,编程 程序 网页图象 建站经验 私服
首页 | 新闻资讯 | 编程开发 | 网页设计 | 图形图象 | 网络媒体 | 网站模板 | 数 据 库 | 投稿
论坛 | 操作系统 | 系统优化 | 网络安全 | 黑客技术 | 硬件学堂 | 硬件报价 | 服 务 器 | 地图
专题 | 应用软件 | 聊天通讯 | Q Q 专栏 | 建站经验 | 在线工具 | 站长Club | 注 册 表 | 旧版
社会 | 游戏娱乐 | 设计欣赏 | 疑难解答 | 社区论坛 | 韩国素材 | 素材图库 | 广告服务 | 服务
当前位置:首页>>操作系统>>注册表>>正文 新版上线![旧版]
注:打开慢时请稍等

VB.NET注册表编程

http://www.iyit.net  日期:2006-6-28 18:18:06  来源:  点击:
参加讨论

  SetValue (存在的健 ,新的健值)

  五.VB.NET是创建并修改注册表信息的程序代码(reg01.vb):

  至此我们不难得到用VB.NET创建并修改注册表的程序代码,在下列代码中,有一点要说明,就是在程序中使用了RegistryKey类中定义另外二个属性:SubKeyCount和ValueCount,其中第一个属性是当前子健下面有多少个子健,第二个是当前子健中定义了多少个健。

Imports System
Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms
Imports Microsoft.Win32
'导入程序中使用的名称空间
Public Class Form1
Inherits Form
Public Sub New ( )
MyBase.New ( )
'初始化窗体中的各个组件
InitializeComponent ( )
End Sub
'清除程序中使用过的各种资源
Protected Overloads Overrides Sub Dispose ( ByVal disposing As Boolean )
If disposing Then
If Not ( components Is Nothing ) Then
components.Dispose ( )
End If
End If
MyBase.Dispose ( disposing )
End Sub
Friend WithEvents Button1 As Button
Friend WithEvents listBox1 As ListBox
Friend WithEvents Button2 As Button
Friend WithEvents Button3 As Button

Private components As System.ComponentModel.Container
'初始化程序中使用到的组件
Private Sub InitializeComponent ( )
Me.listBox1 = New ListBox ( )
Me.Button1 = New Button ( )
Me.Button2 = New Button ( )
Me.Button3 = New Button ( )
Me.SuspendLayout ( )
Me.listBox1.ItemHeight = 12
Me.listBox1.Location = New Point ( 8 , 24 )
Me.listBox1.Name = "listBox1"
Me.listBox1.Size = New Size ( 480 , 292 )
Me.listBox1.TabIndex = 1

...下略

Me.Controls.Add ( Me.listBox1 )
Me.Controls.Add ( Me.Button1 )
Me.Controls.Add ( Me.Button2 )
Me.Controls.Add ( Me.Button3 )
Me.Name = "Form1"
Me.Text = "用VB.NET进行注册表编程!"
Me.ResumeLayout ( False )

End Sub

Private Sub Button1_Click ( ByVal sender As System.Object , ByVal e As System.EventArgs ) _
Handles Button1.Click
listBox1.Items.Clear ( )
Dim hklm As RegistryKey = Registry.LocalMachine
Dim software11 As RegistryKey = hklm.OpenSubKey ( "SYSTEM" )
'打开"SYSTEM"子健
Dim software As RegistryKey = software11.OpenSubKey ( "A000" )
'打开"A000"子健
Dim KeyCount As integer = software.SubKeyCount
'获得当前健下面有多少子健
Dim Str ( ) As String = software.GetSubKeyNames ( )
'获得当前健下面所有子健组成的字符串数组
Dim i As integer
For i = 0 to KeyCount - 1
listBox1.Items.Add ( Str ( i ) )
Dim sitekey As RegistryKey = software.OpenSubKey ( Str ( i ) )
'按顺序打开子健
Dim Str2 ( ) As String = sitekey.GetValueNames ( )
'获得当前子健下面所有健组成的字符串数组
Dim ValueCount As integer = sitekey.ValueCount
'获得当前子健存在多少健值
Dim j As integer
For j = 0 to ValueCount - 1
listBox1.Items.Add ( " " + Str2 ( j ) + ": " + sitekey.GetValue ( Str2 ( j ) ) )
'在列表中加入所有子健、健和健值
Next j
Next i
End Sub
'创建子健,并创建一个健并赋值
Private Sub Button2_Click ( ByVal sender As System.Object , ByVal e As System.EventArgs ) _
Handles Button2.Click
listBox1.Items.Clear ( )
Dim hklm As RegistryKey = Registry.LocalMachine
'打开"SYSTEM"子健
Dim software11 As RegistryKey = hklm.OpenSubKey ( "SYSTEM" ,true )
'打开"A000"子健
Dim software As RegistryKey = software11.OpenSubKey ( "A000" , true )
Dim ddd As RegistryKey = software.CreateSubKey ( "ddd" )
ddd.SetValue ( "www" , "1234" )
End Sub
'重命名一个健的值
Private Sub Button3_Click ( ByVal sender As System.Object , ByVal e As System.EventArgs ) _
Handles Button3.Click
listBox1.Items.Clear ( )
Dim hklm As RegistryKey = Registry.LocalMachine
'打开"SYSTEM"子健
Dim software11 As RegistryKey = hklm.OpenSubKey ( "SYSTEM" ,true )
'打开"A000"子健
Dim software As RegistryKey = software11.OpenSubKey ( "A000" , true )
Dim ddd As RegistryKey = software.CreateSubKey ( "ddd" )
ddd.SetValue ( "www" , "aaaa" )
End Sub

End Class
Module Module1
Sub Main ( )
Application.Run ( New Form1 ( ) )
End Sub
End Module

  经过下列命令编译后,这些可以得到下面界面:

本新闻共4页,当前在第2页  1  2  3  4  


编辑:黑鹰 [发送给好友] [打印本页] [关闭窗口] [返回顶部]
上一篇:让注册表记住VFP应用程序的使用次数
下一篇:没有了
转载请注明来源:www.iyit.net
特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。

 相关文章
在VB中使用注册表 用VB函数轻松访问系统注册表 在VB中调用API操作注册表
VB4.0对注册表操作的命令 asp.net中的vb7中如何调用dll中的函数 asp.net中的vb7中如何使用socket作一个
在ASP.NET中处理 datetime 的一些通用函 在ASP.NET中操作文件的例子(VB) 在ASP.NET中处理datetime的一些通用函数
VB.NET多线程开发实例 多线程填写treeview控件(vb.net) vb.net的windows窗体实现dos命令
 一个用Wsh来控制SqlServer的Dcom的VBs 和我一起入门Direct3D的VB.net编程 VB.NET如何在没有.NET框架的机器上运行
LCS问题算法之VB.net版 VB.net 调用带参数存储过程 vb.net 中实现画图
在VB.Net中创建使用控件数组 VB6 中 善用 ByRef 提升速度 VB6 中使用错误处理对于速度的影响
EJB系列教程之一(JBuilder4+IAS41+Vbj4 如何实现给定日期的若干天以后的日期(有 vBulletin HACK----显示话题大小和打开
最新更新 热点排行 推荐新闻
VB.NET注册表编程
让注册表记住VFP应用程序的使用次数
在VB中使用注册表
利用WindowsAPI函数和注册表获取系统信
MS-DOS方式下对注册表的编程
VB.NET注册表编程
让注册表记住VFP应用程序的使用次数
在VB中使用注册表
利用WindowsAPI函数和注册表获取系统信
MS-DOS方式下对注册表的编程
用注册表给应用程序加口令
对注册表进行编程的“捷径”
用VB函数轻松访问系统注册表
在VB中调用API操作注册表
编程解决注册表问题所需的函数详解
VB.NET注册表编程
让注册表记住VFP应用程序的使用次数
在VB中使用注册表
利用WindowsAPI函数和注册表获取系统信
MS-DOS方式下对注册表的编程
微软将于6月13日发布WORD漏洞补丁
PPLive最新内部版本揭密
移花接木-照片换脸术
CPU降温软件
借助黑龙江网通免费刷取QQ会员
KMPlayer常见问题及解决方法整理
解决局域网不能互相访问之全攻略
用Photoshop替换颜色做漂亮效果图
NERO刻录使用教程
某外企SQL Server面试题
共享软件的十大破解工具推荐
重庆青年建立个人网站 每月固定收入约
没见过 是读卡器也是刻录机!
ASP.NET2.0数据库入门之常见错误
威金蠕虫肆虐互联网 发送病毒链接迅速
流氓软件拉MSN用户征婚 伪装好友发邀请
网际快车1.72完全免费无广告、下载地址
拼音加加VS紫光输入法
给年轻工程师的“十大忠告” 
巧用CSS滤镜做图案文字
 友情链接
设置首 页 - 版权声明 - 广告服务 - 关于我们 - 联系我们 - 友情连接
Copyrights © 2004-2006 iYiT.Net All Rights Reserved.
网站合作、广告联系QQ:147007642、466949678
易特网络技术 点击这里给我发消息