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
"David Gacek" <so*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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()