Click here to Skip to main content
11,575,635 members (61,024 online)

Visual Basic

 
GeneralRe: How to Extend the InitializeComponents to my code in VB2008/2010 Pin
QuickBooksDev21-Jan-13 9:38
memberQuickBooksDev21-Jan-13 9:38 
QuestionMS Graph in Access 2007 VBA Application Pin
satcomengineer19-Jan-13 7:48
membersatcomengineer19-Jan-13 7:48 
AnswerRe: MS Graph in Access 2007 VBA Application Pin
Eddy Vluggen20-Jan-13 2:38
mvpEddy Vluggen20-Jan-13 2:38 
Questionvb6.0 Pin
Barun sengupta18-Jan-13 21:39
memberBarun sengupta18-Jan-13 21:39 
AnswerRe: vb6.0 Pin
Eddy Vluggen20-Jan-13 2:36
mvpEddy Vluggen20-Jan-13 2:36 
QuestionDecoding USBSTOR Registry Entry in VB Pin
SantLou4017-Jan-13 16:06
memberSantLou4017-Jan-13 16:06 
AnswerRe: Decoding USBSTOR Registry Entry in VB Pin
ChandraRam17-Jan-13 20:03
memberChandraRam17-Jan-13 20:03 
AnswerRe: Decoding USBSTOR Registry Entry in VB Pin
Alan N18-Jan-13 1:21
memberAlan N18-Jan-13 1:21 
Your code is essentially correct but what you haven't done is to read the type of data stored in each name-value pair so that the correct cast can be applied.

The raw data obtained from GetValue(valueName) is typed as Object and the ToString() conversion gives a correct representation in most cases, the exceptions being when the actual type is an array (REG_BINARY, REG_MULTI_SZ)

The technique is read the type via GetValueKind(valueName) and then apply a cast to the Object returned from GetValue(valueName). The incomplete method below shows the basics and in your case formatting the values ready for display should be done in the gaps left as "do something appropriate".

Private Sub InterpretValue(rawValue as Object, interpretAsType as RegistryValueKind)
    Select Case interpretAsType
        Case RegistryValueKind.Binary
          ' REG_BINARY
            Dim byteArray As Byte() = DirectCast(rawValue, Byte())
            ' Do something appropriate
            Exit Select
        Case RegistryValueKind.DWord
          ' REG_DWORD
            Dim signedValue32 As Integer = DirectCast(rawValue, Integer)
            ' Do something appropriate
            Exit Select
        Case RegistryValueKind.QWord
          ' REG_QWORD
            Dim signedValue64 As Long = DirectCast(rawValue, Long)
            ' Do something appropriate
            Exit Select
        Case RegistryValueKind.Unknown, RegistryValueKind.String, RegistryValueKind.ExpandString
            Dim stringValue as String = rawValue.ToString()
            ' Do something appropriate
            Exit Select
        Case RegistryValueKind.MultiString
          ' REG_MULTI_SZ
            Dim stringArray As String() = TryCast(rawValue, String())
            ' Do something appropriate
            Exit Select
    End Select
End Sub

GeneralRe: Decoding USBSTOR Registry Entry in VB Pin
SantLou4018-Jan-13 1:47
memberSantLou4018-Jan-13 1:47 
GeneralRe: Decoding USBSTOR Registry Entry in VB Pin
Alan N18-Jan-13 4:05
memberAlan N18-Jan-13 4:05 
JokeRe: Decoding USBSTOR Registry Entry in VB Pin
Jeffnogueira22-Jan-13 4:31
memberJeffnogueira22-Jan-13 4:31 
QuestionVB.NET ReportViewer too many Page Breaks rendered Pin
SantLou4017-Jan-13 3:39
memberSantLou4017-Jan-13 3:39 
AnswerRe: VB.NET ReportViewer too many Page Breaks rendered Pin
ChandraRam17-Jan-13 20:04
memberChandraRam17-Jan-13 20:04 
GeneralRe: VB.NET ReportViewer too many Page Breaks rendered Pin
SantLou4018-Jan-13 1:39
memberSantLou4018-Jan-13 1:39 
Questioncontrol 5 appliances using pc's parallel port[vb.net 2010] Pin
Lord Christian15-Jan-13 20:10
memberLord Christian15-Jan-13 20:10 
AnswerRe: control 5 appliances using pc's parallel port[vb.net 2010] Pin
Bernhard Hiller15-Jan-13 20:42
memberBernhard Hiller15-Jan-13 20:42 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] Pin
Lord Christian17-Jan-13 7:15
memberLord Christian17-Jan-13 7:15 
AnswerRe: control 5 appliances using pc's parallel port[vb.net 2010] Pin
Richard MacCutchan15-Jan-13 22:59
mvpRichard MacCutchan15-Jan-13 22:59 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] Pin
Lord Christian17-Jan-13 6:56
memberLord Christian17-Jan-13 6:56 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] Pin
Richard MacCutchan17-Jan-13 7:10
mvpRichard MacCutchan17-Jan-13 7:10 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] Pin
Lord Christian17-Jan-13 7:33
memberLord Christian17-Jan-13 7:33 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] Pin
Richard MacCutchan17-Jan-13 22:51
mvpRichard MacCutchan17-Jan-13 22:51 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] Pin
Lord Christian18-Jan-13 4:58
memberLord Christian18-Jan-13 4:58 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] Pin
Richard MacCutchan18-Jan-13 5:10
mvpRichard MacCutchan18-Jan-13 5:10 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] Pin
Lord Christian20-Jan-13 18:55
memberLord Christian20-Jan-13 18:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.150624.2 | Last Updated 1 Jul 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid