473,790 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Local Machine.CreateS ubKey("Software \RegTest\")
rk2.SetValue("S tuff vb.net expanded string", New System.String(" %PATH%" &
Microsoft.Visua lBasic.vbNullCh ar))

rk2.Close()


Nov 21 '05 #1
3 3793
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.Exp andEnvironmentV ariables on the value to property read it.

-Rob Teixeira

"David Gacek" <so*****@hotmai l.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.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.Local Machine.CreateS ubKey("Software \RegTest\")
rk2.SetValue("S tuff vb.net expanded string", New System.String(" %PATH%" &
Microsoft.Visua lBasic.vbNullCh ar))

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@@m sn.com> wrote in message
news:ek******** ******@TK2MSFTN GP10.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.Exp andEnvironmentV ariables on the value to property read it.

-Rob Teixeira

"David Gacek" <so*****@hotmai l.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.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.Local Machine.CreateS ubKey("Software \RegTest\")
rk2.SetValue("S tuff vb.net expanded string", New System.String(" %PATH%" & Microsoft.Visua lBasic.vbNullCh ar))

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*****@hotmai l.com> wrote in message
news:O3******** ******@TK2MSFTN GP11.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@@m sn.com> wrote in message
news:ek******** ******@TK2MSFTN GP10.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.Exp andEnvironmentV ariables on the value to property read it.

-Rob Teixeira

"David Gacek" <so*****@hotmai l.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.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.Local Machine.CreateS ubKey("Software \RegTest\") rk2.SetValue("S tuff vb.net expanded string", New
System.String(" %PATH%" & Microsoft.Visua lBasic.vbNullCh ar))

rk2.Close()



Nov 21 '05 #4

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

Similar topics

3
2620
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 at all. So, conceivably as applications are migrated to .NET, the registry could disappear in a future version of Windows. Does anybody out there agree with me? Of course, they might keep the registry for backward compatibility purposes.
0
354
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 folders and desktop. I hope someone can help me to better understand what this log excerpt means, or point me to info sources that do a good job of explaining how to interpret exactly what the various phrases, words, and numbers in the log mean.
1
16328
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 count exceeded. Increase MaxLocksPerFile registry entry." I checked in the Tools - Options - Advance. I have the database shared with no locks selected and record level locking selected.
8
5493
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
1389
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. This seems much too large to be normal, even for a developer's machine. I've read in places that "it's not recommended that you register assemblies in the GAC when developing addins", yet the instructions for adding a path the IDE configuration...
0
12068
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 '/CinemaBookingSystem' Application. -------------------------------------------------------------------------------- ERROR General error Unable to open registry key 'Temporary (volatile) Jet DSN for process
3
2092
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 program, so that the program can check for that key to see if the product has been installed and stop a second installation or illegal installation. If not orphan, can you encrypt the Key so that only your program can decrypt
3
1798
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. Dim aKey As RegistryKey aKey = Registry.CurrentUser.OpenSubKey("software\myApplication") I then attempt to read in any existing values
6
1681
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 object with 10 string items into the registry and retreive them later. I tried this: key.SetValue("lstNSXitems", lstNSX.Items) where "lstNSXitems" is the name of the subkey, and lstNSX.Items is the
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10413
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.