Link to home
Start Free TrialLog in
Avatar of JStungis
JStungisFlag for United States of America

asked on

Reg_binary data type written to the windows XP registry from visual basic

I want to use the following to set the value of a name/value pair in the Windows XP registry:

registry.setvalue(basekeyname, keyName, Keyvalue)

How do I declare  Keyvalue in visual basic so that it ends up as type REG_BINARY in the registry.

I've tried the following  declaration but  the value shows up as type REG_SZ in the registry:

dim Keyvalue as byte = 0

thanks, Jim

Avatar of Priest04
Flag of Serbia image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JStungis


thanks -- this works  to place a value of 0 in the registry as REG_BINARY when I have previously declared Keyvalue in Visual Basic as follows:

Dim Keyvalue as byte() = {0}
Can you post exactly what you want to do, so I can understand what is the problem.

THERE IS NO PROBLEM. Your suggestion works well i.e use the following call :

My.Computer.Registry.SetValue(basekeyname,  keyName, Keyvalue, Microsoft.Win32.RegistryValueKind.Binary)

If I have previously declared the variable, KeyValue as follows:

Dim Keyvalue as byte() = {0}

thanks, Jim
So, my suggestion works well, but you have accepted your post as answer. Interesting.... :)))
I accept your post as the answer. I was merely adding information to your solution to remind myself (for future reference) what had to be done in addition to your answer to get it to work from an actual visual basic program
Well, actually, you didn't. :) If you did accept my post, then the question would be immediately closed. As you can see, it is still open. To accept my post as answer, you need to click on the Accept Answer in the post you want to mark as answer.