Avatar of JStungis
JStungis
Flag 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

Visual Basic.NET

Avatar of undefined
Last Comment
Priest04

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Priest04

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
JStungis

ASKER
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}
Priest04

Can you post exactly what you want to do, so I can understand what is the problem.

Goran
JStungis

ASKER
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
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Priest04

So, my suggestion works well, but you have accepted your post as answer. Interesting.... :)))
JStungis

ASKER
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
Priest04

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.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.