Sorting Registries in VB .NET


So there’s this guy from http://leetcoders.org that needed some help getting a function created for him to breakup a single string that contains Name, Registry Key and Registry Data and appends the strings into a richtextbox.

AutoCAD 2010|Serial=HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8001:409\=SerialNumber

to

RichTextBox1.AppendText(“Autocad 2010” & vbNewLine)
Dim ammSteal01 As String = Registry.GetValue(“HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8001:409”, “SerialNumber”, Nothing)
RichTextBox1.AppendText(ammSteal01)

So i created a simple function called
Private Sub AppendStringToRichTextBox2(ByVal str As String, ByVal txtbox As RichTextBox)

which does

        Dim title As String = ""
        Dim key As String = ""
        Dim data As String = ""

        Dim str_arr As String() = str.Split("=")

        key = str_arr(1)
        data = str_arr(2)

        For i = 0 To str_arr(0).Length - 1
            If str_arr(0)(i) = "|" Then
                Exit For
            End If

            title += str_arr(0)(i)
        Next

        txtbox.AppendText(title & vbNewLine)
        txtbox.AppendText(Microsoft.Win32.Registry.GetValue(key, data, Nothing))

The function generally appends the name of the application and the value of the key that have been called via Registry.GetValue. Well it’s nothing hard so port it to your own use if you need it.

Advertisements

One Response to “Sorting Registries in VB .NET”

  1. t_io Says:

    I would like to exchange links with your site genesisdatabase.wordpress.com
    Is this possible?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: