473,499 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Registry - Current user

In my application I have following part of code:
using System;

using Microsoft.Win32;

using System.Diagnostics;

....

RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\xxx\\yy y\\")

end everything works normally..

Problem description:
----------------------
I am trying to implement the same functionality on another app and I am
receiving following error:
'HEUpdate.Registry' does not contain a definition for 'CurrentUser'

I can not se what is wrong, probably is trivial but I can not see :(

If you know where problem is, please help. Thanks.


Nov 17 '05 #1
3 4894
Use CreateSubKey instead of OpenSubKey.

CreateSubKey will open or create the key if it doesn't already exist.

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Washington" <ab******@yahoo.com> wrote in message news:eT**************@TK2MSFTNGP12.phx.gbl...
In my application I have following part of code:
using System;

using Microsoft.Win32;

using System.Diagnostics;

...

RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\xxx\\yy y\\")

end everything works normally..

Problem description:
----------------------
I am trying to implement the same functionality on another app and I am receiving following error:
'HEUpdate.Registry' does not contain a definition for 'CurrentUser'

I can not se what is wrong, probably is trivial but I can not see :(

If you know where problem is, please help. Thanks.


Nov 17 '05 #2
HEUpdate doesn't look familiar. Does that other app define, or include
a library that defines, a namespaces called HEUpdate that has a class
called Registry?

Your code is probably being interpreted incorrectly by the compiler
because the compiler thinks you're referring to a locally defined class
called Registry when in fact you want to refer to
Microsoft.Win32.Registry.

You can fix this by modifying your code to use the fully qualified name
of the Registry class:

Microsoft.Win32.RegistryKey key =
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("S oftware\\xxx\\yyy\\");

Of course, in this case you don't need the

using Microsoft.Win32;

statement at the top of your program.

Nov 17 '05 #3
Thanks :)

"Bruce Wood" <br*******@canada.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
HEUpdate doesn't look familiar. Does that other app define, or include
a library that defines, a namespaces called HEUpdate that has a class
called Registry?

Your code is probably being interpreted incorrectly by the compiler
because the compiler thinks you're referring to a locally defined class
called Registry when in fact you want to refer to
Microsoft.Win32.Registry.

You can fix this by modifying your code to use the fully qualified name
of the Registry class:

Microsoft.Win32.RegistryKey key =
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("S oftware\\xxx\\yyy\\");

Of course, in this case you don't need the

using Microsoft.Win32;

statement at the top of your program.

Nov 17 '05 #4

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

Similar topics

2
7149
by: Bob Olsson | last post by:
Hello all! I´m going to develop a windows smartclient and can´t find the information I need. Where do I store user-settings like paths, background colour and so on. I´ve read an article about...
1
16291
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...
3
3035
by: Slimo | last post by:
Hello, I'm searching some example of code (VB) for reading remote registry subkeys and keys. Thanks
2
1955
by: Henry Fleming | last post by:
I have an C# assembly that is supposed to read a registry key: RegistryKey regCurrentUser = Registry.CurrentUser; RegistryKey regSoftware = regCurrentUser.OpenSubKey("Software",true);...
3
1523
by: techmaccoy | last post by:
I am trying to access a entry under HKEY_Current_USER/Software. In My code it List seven subkeys under there. Actually there are lot more and the entry i wanted to access in seen in the Registry,...
7
1192
by: Austin Myers | last post by:
I don't think I can do what I wanted initially, setting a registry keys permissions via code and grant user permission. So, can anyone tell me, is there a place in the registry where people...
4
3215
by: yxq | last post by:
Hello, I want to get the registry key permission information whether current user has the permission to delete the registry key using RegistryRights, how to do? thank you.
3
3018
by: YXQ | last post by:
Hello, I need to programmatically take ownership of a registry-key as current user using VB2005. To test this , i created a key HKEY_LOCAL_MACHINE\Software\TestKey and removed all accessrights...
2
2073
by: =?Utf-8?B?QW5qYW5h?= | last post by:
Hello we creating a web application in ASP .net 2.0. we are trying to read font file path from registry as below Microsoft.Win32.RegistryKey registryKeyParen registryKeyChild =...
3
1635
by: thephatp | last post by:
BLUF: I need to build up the actual %TEMP% path for all users methodically using values in the registry, and I need to do this both by the current user AND as a service will do this running as...
0
7131
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,...
0
7007
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...
0
7174
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,...
0
7388
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...
1
4919
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...
0
4600
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...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
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...

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.