Click here to Skip to main content
15,885,546 members
Articles / Programming Languages / Visual Basic

How to Program for Windows Registry

Rate me:
Please Sign up or sign in to vote.
3.31/5 (57 votes)
16 Mar 2010CPOL1 min read 52.1K   995   45  
This article will guide you how to create/retrieve/delete key entries in Windows Registry.
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmLogin
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    '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.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmLogin))
        Me.tabLogin = New System.Windows.Forms.TabControl
        Me.tabLoginSystems = New System.Windows.Forms.TabPage
        Me.Label1 = New System.Windows.Forms.Label
        Me.prgsBar = New System.Windows.Forms.ProgressBar
        Me.btnSysDeleteItem = New System.Windows.Forms.Button
        Me.btnSysChangeItem = New System.Windows.Forms.Button
        Me.btnSysCreateItem = New System.Windows.Forms.Button
        Me.btnSysLogin = New System.Windows.Forms.Button
        Me.dgvLoginSystems = New System.Windows.Forms.DataGridView
        Me.tabLogin.SuspendLayout()
        Me.tabLoginSystems.SuspendLayout()
        CType(Me.dgvLoginSystems, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'tabLogin
        '
        Me.tabLogin.Controls.Add(Me.tabLoginSystems)
        Me.tabLogin.Dock = System.Windows.Forms.DockStyle.Fill
        Me.tabLogin.ItemSize = New System.Drawing.Size(80, 20)
        Me.tabLogin.Location = New System.Drawing.Point(0, 0)
        Me.tabLogin.Name = "tabLogin"
        Me.tabLogin.SelectedIndex = 0
        Me.tabLogin.Size = New System.Drawing.Size(344, 389)
        Me.tabLogin.SizeMode = System.Windows.Forms.TabSizeMode.Fixed
        Me.tabLogin.TabIndex = 0
        '
        'tabLoginSystems
        '
        Me.tabLoginSystems.AutoScrollMargin = New System.Drawing.Size(2, 1)
        Me.tabLoginSystems.BackColor = System.Drawing.SystemColors.InactiveBorder
        Me.tabLoginSystems.Controls.Add(Me.Label1)
        Me.tabLoginSystems.Controls.Add(Me.prgsBar)
        Me.tabLoginSystems.Controls.Add(Me.btnSysDeleteItem)
        Me.tabLoginSystems.Controls.Add(Me.btnSysChangeItem)
        Me.tabLoginSystems.Controls.Add(Me.btnSysCreateItem)
        Me.tabLoginSystems.Controls.Add(Me.btnSysLogin)
        Me.tabLoginSystems.Controls.Add(Me.dgvLoginSystems)
        Me.tabLoginSystems.Location = New System.Drawing.Point(4, 24)
        Me.tabLoginSystems.Name = "tabLoginSystems"
        Me.tabLoginSystems.Padding = New System.Windows.Forms.Padding(4)
        Me.tabLoginSystems.Size = New System.Drawing.Size(336, 361)
        Me.tabLoginSystems.TabIndex = 0
        Me.tabLoginSystems.Text = "Systems"
        Me.tabLoginSystems.UseVisualStyleBackColor = True
        '
        'Label1
        '
        Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.Label1.AutoSize = True
        Me.Label1.BackColor = System.Drawing.SystemColors.ControlLightLight
        Me.Label1.Location = New System.Drawing.Point(257, 51)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(76, 13)
        Me.Label1.TabIndex = 5
        Me.Label1.Text = "Connecting....."
        Me.Label1.Visible = False
        '
        'prgsBar
        '
        Me.prgsBar.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.prgsBar.Location = New System.Drawing.Point(258, 32)
        Me.prgsBar.Maximum = 10000
        Me.prgsBar.Name = "prgsBar"
        Me.prgsBar.Size = New System.Drawing.Size(75, 16)
        Me.prgsBar.Step = 1
        Me.prgsBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous
        Me.prgsBar.TabIndex = 1
        Me.prgsBar.Visible = False
        '
        'btnSysDeleteItem
        '
        Me.btnSysDeleteItem.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnSysDeleteItem.BackColor = System.Drawing.SystemColors.ButtonFace
        Me.btnSysDeleteItem.ForeColor = System.Drawing.SystemColors.ControlText
        Me.btnSysDeleteItem.Location = New System.Drawing.Point(258, 330)
        Me.btnSysDeleteItem.Name = "btnSysDeleteItem"
        Me.btnSysDeleteItem.Size = New System.Drawing.Size(75, 23)
        Me.btnSysDeleteItem.TabIndex = 4
        Me.btnSysDeleteItem.Text = "&Delete Item"
        Me.btnSysDeleteItem.UseVisualStyleBackColor = False
        '
        'btnSysChangeItem
        '
        Me.btnSysChangeItem.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnSysChangeItem.BackColor = System.Drawing.SystemColors.ButtonFace
        Me.btnSysChangeItem.ForeColor = System.Drawing.SystemColors.ControlText
        Me.btnSysChangeItem.Location = New System.Drawing.Point(258, 301)
        Me.btnSysChangeItem.Name = "btnSysChangeItem"
        Me.btnSysChangeItem.Size = New System.Drawing.Size(75, 23)
        Me.btnSysChangeItem.TabIndex = 3
        Me.btnSysChangeItem.Text = "C&hange Item"
        Me.btnSysChangeItem.UseVisualStyleBackColor = False
        '
        'btnSysCreateItem
        '
        Me.btnSysCreateItem.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnSysCreateItem.BackColor = System.Drawing.SystemColors.ButtonFace
        Me.btnSysCreateItem.ForeColor = System.Drawing.SystemColors.ControlText
        Me.btnSysCreateItem.Location = New System.Drawing.Point(258, 272)
        Me.btnSysCreateItem.Name = "btnSysCreateItem"
        Me.btnSysCreateItem.Size = New System.Drawing.Size(75, 23)
        Me.btnSysCreateItem.TabIndex = 2
        Me.btnSysCreateItem.Text = "&Create Item"
        Me.btnSysCreateItem.UseVisualStyleBackColor = False
        '
        'btnSysLogin
        '
        Me.btnSysLogin.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnSysLogin.BackColor = System.Drawing.SystemColors.ButtonFace
        Me.btnSysLogin.Location = New System.Drawing.Point(258, 3)
        Me.btnSysLogin.Name = "btnSysLogin"
        Me.btnSysLogin.Size = New System.Drawing.Size(75, 23)
        Me.btnSysLogin.TabIndex = 1
        Me.btnSysLogin.Text = "&Login"
        Me.btnSysLogin.UseVisualStyleBackColor = False
        '
        'dgvLoginSystems
        '
        Me.dgvLoginSystems.AllowUserToAddRows = False
        Me.dgvLoginSystems.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.dgvLoginSystems.BackgroundColor = System.Drawing.SystemColors.HighlightText
        Me.dgvLoginSystems.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None
        Me.dgvLoginSystems.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Sunken
        Me.dgvLoginSystems.ColumnHeadersHeight = 22
        Me.dgvLoginSystems.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing
        Me.dgvLoginSystems.Location = New System.Drawing.Point(3, 3)
        Me.dgvLoginSystems.MultiSelect = False
        Me.dgvLoginSystems.Name = "dgvLoginSystems"
        Me.dgvLoginSystems.ReadOnly = True
        Me.dgvLoginSystems.RowHeadersVisible = False
        Me.dgvLoginSystems.RowTemplate.Height = 18
        Me.dgvLoginSystems.RowTemplate.ReadOnly = True
        Me.dgvLoginSystems.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.[False]
        Me.dgvLoginSystems.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
        Me.dgvLoginSystems.Size = New System.Drawing.Size(249, 355)
        Me.dgvLoginSystems.TabIndex = 0
        '
        'frmLogin
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.BackColor = System.Drawing.SystemColors.InactiveBorder
        Me.ClientSize = New System.Drawing.Size(344, 389)
        Me.Controls.Add(Me.tabLogin)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Location = New System.Drawing.Point(25, 50)
        Me.Name = "frmLogin"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "IBS Login"
        Me.tabLogin.ResumeLayout(False)
        Me.tabLoginSystems.ResumeLayout(False)
        Me.tabLoginSystems.PerformLayout()
        CType(Me.dgvLoginSystems, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub
    Friend WithEvents tabLogin As System.Windows.Forms.TabControl
    Friend WithEvents tabLoginSystems As System.Windows.Forms.TabPage
    Friend WithEvents btnSysDeleteItem As System.Windows.Forms.Button
    Friend WithEvents btnSysChangeItem As System.Windows.Forms.Button
    Friend WithEvents btnSysCreateItem As System.Windows.Forms.Button
    Friend WithEvents btnSysLogin As System.Windows.Forms.Button
    Public WithEvents dgvLoginSystems As System.Windows.Forms.DataGridView
    Friend WithEvents prgsBar As System.Windows.Forms.ProgressBar
    Friend WithEvents Label1 As System.Windows.Forms.Label
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead Cherisys Technologies
India India
Senior Software Professional with 13+ years of experience in web/desktop applications development.

Comments and Discussions