I'm getting an error I'm very new to vb.net and designing an application with visual studio 2019.

My application is to Read the registry key open subkey to retrieve displayname and displayversion. I would like to add an array to read multiple key values under the key locations for both x86 and x64 and get the values and then determine if the program needs to be upgraded. I also want to import new list of keys and program criteria I was thinking to use xml to allow for this. Is there any good examples of this or is this possible?

2nd Part of my code I haven't written yet is to execute uninstall if the version doesn't match the required criteria

Regkey_app.PNG

Imports System
Imports Microsoft.Win32

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim Key86 As String
        Dim Key64 As String
        Dim rk1 As RegistryKey
        Dim rk2 As RegistryKey
        Dim sk As RegistryKey
        Dim skName As String
        Dim sublist As New ArrayList

        Key86 = "Software\Microsoft\Windows\CurrentVersion\Uninstall\{{26A24AE4-039D-4CA4-87B4-2F32180301F0}}"
        Key64 = "SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F64180301F0}"


        rk1 = Registry.LocalMachine.OpenSubKey(Key86, True)
        rk2 = Registry.LocalMachine.OpenSubKey(Key64, True)


        For Each skName In rk1.GetSubKeyNames()
            sk = rk1.OpenSubKey(skName)
            sublist.Add(sk.GetValue("DisplayName"))
            sublist.Add(sk.GetValue("DisplayVersion"))
        Next skName
        For Each skName In rk2.GetSubKeyNames()
            sk = rk2.OpenSubKey(skName)
            sublist.Add(sk.GetValue("DisplayName"))
            sublist.Add(sk.GetValue("DisplayVersion"))
        Next skName

        ListBox1.Items.Add(rk1)
        ListBox2.Items.Add(rk2)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.