Necro.
Necro.

Reputation: 987

VB.net | Writing a REG_BINARY to the registry

I'm trying to write a REG_BINARY to the registry, but for some reason the second set of text is giving an error saying its expecting a }?

My.Computer.Registry.SetValue("HKEY_CURRENT_USER\TEST", "KEY", New Byte() {86, 23, E3, 92, 1E, E8, 65, 07, D5, 12, 1E, E3, E3, E3, E3},RegistryValueKind.Binary)

How would I write that into the registry as REG_BINARY?

After ab it states cd expected a } after it?

EDIT

I'm Sorry for not mentioning...It really does make a difference to the question, the content I'm trying to write is HEX.

Upvotes: 0

Views: 2591

Answers (1)

Christian Hayter
Christian Hayter

Reputation: 31071

That's not legal VB.NET syntax for an array initialiser. You need to separate each array element value with a comma, e.g. New Byte() {0,1,2,3,4}. If you want to write hex values instead of decimal, use the &H prefix, e.g New Byte() {&H0,&H1,&H2,&H3,&H4}.

Upvotes: 3

Related Questions