473,378 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Registry

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()


Nov 21 '05 #1
3 3735
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()

Nov 21 '05 #2
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.?
"Rob Teixeira" <RobTeixeira@@msn.com> wrote in message
news:ek**************@TK2MSFTNGP10.phx.gbl...
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()


Nov 21 '05 #3
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
"David Gacek" <so*****@hotmail.com> wrote in message
news:O3**************@TK2MSFTNGP11.phx.gbl...
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.?
"Rob Teixeira" <RobTeixeira@@msn.com> wrote in message
news:ek**************@TK2MSFTNGP10.phx.gbl...
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()



Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rohit Santhanam | last post by:
As I am reading the .NET documentation, I get the feeling that Microsoft is trying to get rid of the registry. My understanding is that an application built using .NET does not use the registry...
0
by: vincemoon | last post by:
Below is an excerpt from my Registry Log, created by Redmon, showing the process whereby TweakUI added the compressed folder option to the new sub-menu in the right click context menu for open...
1
by: rdavis7408 | last post by:
I have a database that has a form that opens a report using date parameters. I have been using it for six months and last week I began to get the following Error Message: "File sharing lock...
8
by: Al Kaufman | last post by:
I have a simple console app that uses: regSubKey = <some registry key> Dim reg As RegistryKey = Registry.ClassesRoot.OpenSubKey(regSubKey) Dim path As String path = CStr(reg.GetValue(""))
4
by: Bob | last post by:
My question about how to add an assembly search path to VS.NET's IDE remains unanswered, but I'm still faced with a problem possibly associated with this: my exported registry is more than 67MB....
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
3
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Is there a way to create a registry key, but orphan it from the program that created it? Reason: Create a key, but not associate it with the...
3
by: Aussie Rules | last post by:
Hi, I want to store some data in the registry, however I have not been able to do this, and think my logic maybe flawed. Firstly I try to open the registry and read in any existing values....
6
by: JOSII | last post by:
Getting a string of boolean value into and out of the registry is no problem. Here's the problem: Although you can place an object into the registry and retreive it, I need to place an ArrayList...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.