473,803 Members | 3,424 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 3796
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
5497
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
1391
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
12070
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
2093
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
1801
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
1685
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
9566
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
10555
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
10317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10300
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7607
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5503
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
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
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.