Results 1 to 2 of 2

Thread: Writing Hex to a Binary key?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    25

    Smile

    I didn't see a post on this so I'll toss it out here.

    Just how do you write Hex values to a Binary registry key?
    The registry demo program from this site chokes with a Type Mismatch eror when you enter a value such as 1F instead of 1.

    Dim byTemp(2) As Byte

    byTemp(0) = CByte(txtByte(0)) <---The error occurs here
    byTemp(1) = CByte(txtByte(1))
    byTemp(2) = CByte(txtByte(2))

    SaveSettingByte HKEY_CURRENT_USER, "Software\VBW\RegistryDemo", "Byte", byTemp

    Should something other than cbyte be used?
    Or possibly change it to CByte("&H" & txtByte(0)) ?

    Thanks,
    James

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    25

    Thumbs up

    That appears to be it!

    byTemp(0) = CByte("&H" & txtByte(0)

    Adding &H to the beginning of the array value lets it be accepted as a hex value. That just occured to me as I was writing that last post.

    Scary huh? Answered my own question that time... hehe



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width