Registry

  • Thread starter Thread starter David Gacek
  • Start date Start date
D

David Gacek

How do you write a new Reg_Expand_sz value to the resgistry with vb.net
this used to work when you pad the string with a null.

Anyone know how or what i'm doing wrong ? It just writes a new Reg_sz value
to the reg.

Dim rk2 As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.LocalMachine.CreateSubKey("Software\RegTest\")
rk2.SetValue("Stuff vb.net expanded string", New System.String("%PATH%" &
Microsoft.VisualBasic.vbNullChar))

rk2.Close()
 
First of all, are you getting some error?

Secondly, the RegistryKey class writes strings as sz only. If the value was
originally definined as expand_sz, it will retain that flag, but you cannot
control that from the .NET class. In either case, the value will always
contain the unexpanded path, so you'll always have to use
Environment.ExpandEnvironmentVariables on the value to property read it.

-Rob Teixeira
 
what i want to do is create a new Expandable string value in the registry
with vb.net i am not getting an error .
Can this be done with vb.net? and if so how.?
 
So when i open the registry editor i can see that it created a new
Expandable string value.
I can create all the other types of values expect for the one in question.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top