' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Imports System
Imports System.Drawing
Imports System.Windows.Forms

Imports Microsoft.Win32

Namespace DefaultNamespace
    Public Class MainForm
    Inherits Form
        Private btn As Button
        Private tb As TextBox

        Public Sub New()
            InitializeComponent
        End Sub

        <STAThread()> _
        Public Shared Sub Main(ByVal args As String())
            Application.Run(New MainForm)
        End Sub

        Private Sub InitializeComponent()
            tb = New TextBox
            btn = New Button
            SuspendLayout
            tb.Location = New Point(50, 50)
            tb.Size = New Size(400, 200)
            tb.Multiline = True
            tb.Text = ""
            btn.Location = New Point(50, 300)
            btn.Size = New Size(400, 50)
            btn.Text = "Hent"
            AddHandler btn.Click, AddressOf ButtonClick
            ClientSize = New System.Drawing.Size(500, 400)
            Controls.Add(btn)
            Controls.Add(tb)
            Name = "Main Form"
            ResumeLayout(False)
        End Sub

        Sub ButtonClick(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim dir As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Microsoft").OpenSubKey("ASP.NET").OpenSubKey("1.1.4322.0")
            Dim vals As String() = dir.GetValueNames
            For Each v As String In vals
                Dim data As String = CType(dir.GetValue(v), String)
                tb.Text += (v & "=" & data & Convert.ToChar(13) & Convert.ToChar(10))
            Next
        End Sub
    End Class 
End Namespace
