Click here to Skip to main content
       

Visual Basic

 
GeneralRe: How to Extend the InitializeComponents to my code in VB2008/2010 PinmemberQuickBooksDev21-Jan-13 5:28 
GeneralRe: How to Extend the InitializeComponents to my code in VB2008/2010 PinmvpEddy Vluggen21-Jan-13 5:43 
GeneralRe: How to Extend the InitializeComponents to my code in VB2008/2010 PinmemberQuickBooksDev21-Jan-13 6:49 
GeneralRe: How to Extend the InitializeComponents to my code in VB2008/2010 PinmemberQuickBooksDev22-Jan-13 0:21 
GeneralRe: How to Extend the InitializeComponents to my code in VB2008/2010 PinmvpEddy Vluggen22-Jan-13 2:21 
AnswerRe: How to Extend the InitializeComponents to my code in VB2008/2010 PinmemberMike Meinz21-Jan-13 8:16 
GeneralRe: How to Extend the InitializeComponents to my code in VB2008/2010 PinmemberQuickBooksDev21-Jan-13 9:38 
QuestionMS Graph in Access 2007 VBA Application Pinmembersatcomengineer19-Jan-13 7:48 
AnswerRe: MS Graph in Access 2007 VBA Application PinmvpEddy Vluggen20-Jan-13 2:38 
Questionvb6.0 PinmemberBarun sengupta18-Jan-13 21:39 
AnswerRe: vb6.0 PinmvpEddy Vluggen20-Jan-13 2:36 
QuestionDecoding USBSTOR Registry Entry in VB PinmemberSantLou4017-Jan-13 16:06 
AnswerRe: Decoding USBSTOR Registry Entry in VB PinmemberChandraRam17-Jan-13 20:03 
AnswerRe: Decoding USBSTOR Registry Entry in VB PinmemberAlan 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 PinmemberSantLou4018-Jan-13 1:47 
GeneralRe: Decoding USBSTOR Registry Entry in VB PinmemberAlan N18-Jan-13 4:05 
JokeRe: Decoding USBSTOR Registry Entry in VB PinmemberJeffnogueira22-Jan-13 4:31 
QuestionVB.NET ReportViewer too many Page Breaks rendered PinmemberSantLou4017-Jan-13 3:39 
AnswerRe: VB.NET ReportViewer too many Page Breaks rendered PinmemberChandraRam17-Jan-13 20:04 
GeneralRe: VB.NET ReportViewer too many Page Breaks rendered PinmemberSantLou4018-Jan-13 1:39 
Questioncontrol 5 appliances using pc's parallel port[vb.net 2010] PinmemberLord Christian15-Jan-13 20:10 
AnswerRe: control 5 appliances using pc's parallel port[vb.net 2010] PinmemberBernhard Hiller15-Jan-13 20:42 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] PinmemberLord Christian17-Jan-13 7:15 
AnswerRe: control 5 appliances using pc's parallel port[vb.net 2010] PinmvpRichard MacCutchan15-Jan-13 22:59 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] PinmemberLord Christian17-Jan-13 6:56 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] PinmvpRichard MacCutchan17-Jan-13 7:10 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] PinmemberLord Christian17-Jan-13 7:33 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] PinmvpRichard MacCutchan17-Jan-13 22:51 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] PinmemberLord Christian18-Jan-13 4:58 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] PinmvpRichard MacCutchan18-Jan-13 5:10 
GeneralRe: control 5 appliances using pc's parallel port[vb.net 2010] PinmemberLord Christian20-Jan-13 18:55 
QuestionBuilding COM Components Using MATLAB - Part I PinmemberSergentX13-Jan-13 6:35 
AnswerRe: Building COM Components Using MATLAB - Part I PinmvpEddy Vluggen14-Jan-13 3:13 
GeneralMessage Removed PinmemberSergentX14-Jan-13 8:20 
AnswerRe: Building COM Components Using MATLAB - Part I PinmvpEddy Vluggen14-Jan-13 9:59 
QuestionDebug user control in VB6.0 ? PinmemberMember 24584678-Jan-13 22:38 
AnswerRe: Debug user control in VB6.0 ? PinmemberChandraRam17-Jan-13 20:08 
QuestionHow make DOWNLOADER in VB 2010 ? Pinmemberradoslaw1238-Jan-13 7:21 
AnswerRe: How make DOWNLOADER in VB 2010 ? [modified] PinmemberGuyThiebaut8-Jan-13 21:53 
GeneralRe: How make DOWNLOADER in VB 2010 ? Pinmemberradoslaw1239-Jan-13 0:36 
GeneralRe: How make DOWNLOADER in VB 2010 ? PinmemberGuyThiebaut9-Jan-13 0:40 
QuestionIOException was Unhandled Pinmemberjankevint7-Jan-13 14:37 
AnswerRe: IOException was Unhandled PinmvpDave Kreskowiak7-Jan-13 18:08 
GeneralRe: IOException was Unhandled Pinmemberjankevint7-Jan-13 21:52 
AnswerRe: IOException was Unhandled PinmvpRichard MacCutchan7-Jan-13 22:26 
GeneralRe: IOException was Unhandled Pinmemberjankevint7-Jan-13 23:18 
GeneralRe: IOException was Unhandled PinmvpRichard MacCutchan7-Jan-13 23:31 
AnswerRe: IOException was Unhandled PinmemberMike Meinz22-Jan-13 3:15 
GeneralTo calculate with two - three & four criteria multiple worksheet in summary sheet Pinmemberatulkhandekar3-Jan-13 21:42 
AnswerRe: To calculate with two - three & four criteria multiple worksheet in summary sheet PinmemberEddy Vluggen4-Jan-13 22:48 

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
Web02 | 2.8.140921.1 | Last Updated 22 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid