转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件开发 >> VB.NET程序 >> 正文
走近VB.Net(十二) 注册表快速入门         ★★★★

走近VB.Net(十二) 注册表快速入门

作者:闵涛 文章来源:闵涛的学习笔记 点击数:3022 更新时间:2009/4/23 19:01:15

 

 

 

       走近VB.Net(十二) 注册表快速入门
                      作者:hejianzhong VB.Net中文站(http://vbnetcn.126.com)
   首先介绍一下注册表的相关基础知识:注册表的每一个文件夹被称为一个Key(项),这个文件夹的子文件夹被称为SubKey(子
项),而在一个子项中有不同的Value Name(值项—即数值顶),值项后面就是你要保存的数据Value Data(数据)了。而在子项中
通常都有一个Default Value 是默认的Value Name,相信打开过注册表的一定看得很清楚:
                     好了,我们现在看一下如何写入注册表。
     最易的方法就是使用VB内置的函数了,这与VB6中使用的方法一模一样:
————————————————————————————————————————
设置Sub SaveSetting(AppName As String,Section As String,Key As String,Setting As String)
获取 Function GetSetting(AppName As String,Section As String,Key As String,[Default As String])
删除DeleteSetting(AppName As String,[Section As String=nothing],[Key As String=nothing] )
————————————————————————————————————————————————
     不过他只能写在一个固定的位置,写入HKEY_CURRENT_USER//Software//VB and VBA Program Setting.当我们需要使
用注册表加密时,总不能写在这样一个大家都知道的地方吧?还有当我们要使用注册表实现一些功能时(如写入run主键让程序
启动时自运行)这个更是无能为力。相信大家都看过VB6的例程,很是复杂。不过我看的一个系列文章写得很好(在我的网站
---VB6知识库中有收录)竟有七八页。在VB.Net中就很简单了,跟上面真有些差不多。--------(不过我可是研究了很久的,很辛
苦---最近有人把我的文章改成自已的名字,我很伤心,也请这些人自重,再次声明在任何地方张贴必须经过我的同意,并明确
标明:“作者:hejianzhong  VB.Net中文站 http:://vbnetcn.126.com.”的字样)
我在这里写了一个模块,只是为了示例,大家在使用的时候记住不需要像我这样另外使用模块(应该根据你的需要灵活运
用),这有些画蛇添足。这个我也不打算提供源码下载,因为实在太简单了。
      首先如图添加控件:
 
      textbox控件的text设为“”,其它的请作相应的修改,实际上这个示例你不编也可以,只要看懂下面的内容就行了:
写代码如下:
 

Imports System.ComponentModel

Imports System.Drawing

Imports System.WinForms

 

 

Public Class Form1

    Inherits System.WinForms.Form

 

    Public Sub New()

        MyBase.New

 

        Form1 = Me

 

        ''''This call is required by the Win Form Designer.

        InitializeComponent

 

        ''''TODO: Add any initialization after the InitializeComponent() call

    End Sub

 

    ''''Form overrides dispose to clean up the component list.

    Overrides Public Sub Dispose()

        MyBase.Dispose

        components.Dispose

    End Sub

下面这些

#Region " Windows Form Designer generated code "

 

    ''''Required by the Windows Form Designer

    Private components As System.ComponentModel.Container

   

    Private WithEvents Label2 As System.WinForms.Label

   

   

    Private WithEvents Label1 As System.WinForms.Label

    Private WithEvents TextBox2 As System.WinForms.TextBox

   

   

    Private WithEvents Button4 As System.WinForms.Button

    Private WithEvents Button3 As System.WinForms.Button

   

    Private WithEvents TextBox1 As System.WinForms.TextBox

    Private WithEvents Button1 As System.WinForms.Button

   

   

    Private WithEvents RadioButton2 As System.WinForms.RadioButton

    Private WithEvents RadioButton1 As System.WinForms.RadioButton

   

    Dim WithEvents Form1 As System.WinForms.Form

 

    ''''NOTE: The following procedure is required by the Windows Form Designer

    ''''It can be modified using the Windows Form Designer. 

    ''''Do not modify it using the code editor.

    Private Sub InitializeComponent()

        Me.components = New System.ComponentModel.Container()

[1] [2] [3] [4]  下一页


[网络安全]安装防火墙的十二个注意事项  [网页制作]个人网站推广的十二个好方法(精选版)
[办公软件]掌握Excel十二条操作技巧,让工作更效益  [ORACLE]ORACLE SQL性能优化系列 (十二)
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · C语言系列  · VB.NET程序
    · JAVA开发  · Delphi程序
    · 脚本语言
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台