Option Strict On
Public Module RegistryTest
Public Sub Main()
Dim data As Object
data = My.Computer.Registry.GetValue("HKEY_CLASSES_ROOT\wrifile\DefaultIcon", _
String.Empty, String.Empty)
If TypeOf data Is String Then
Console.WriteLine("String data: " & data.ToString())
ElseIf TypeOf data Is Integer Then
Console.WriteLine("Integer data: " & CInt(data))
ElseIf TypeOf data Is String() Then
Console.WriteLine("String array: ")
Dim dataArray() As String = DirectCast(data, String())
For ctr As Integer = LBound(dataArray, 1) To UBound(dataArray, 1)
Console.WriteLine(" " & dataArray(ctr))
Next
ElseIf typeOf data Is Byte() Then
Console.WriteLine("Binary data: ")
Dim byteArray() As Byte = DirectCast(data, Byte())
For ctr As Integer = LBound(byteArray, 1) To UBound(byteArray, 1)
Console.Write(" " & Hex(byteArray(ctr)) & " ")
Next
Else
Console.WriteLine("Unknown data type...")
End If
End Sub
End Module
String data: "C:\Program Files\Windows NT\Accessories\WORDPAD.EXE",2