473,807 Members | 2,883 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.Diagnost ics;

....

RegistryKey key = Registry.Curren tUser.OpenSubKe y("Software\\xx x\\yyy\\")

end everything works normally..

Problem description:
----------------------
I am trying to implement the same functionality on another app and I am
receiving following error:
'HEUpdate.Regis try' 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 4906
Use CreateSubKey instead of OpenSubKey.

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

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

using Microsoft.Win32 ;

using System.Diagnost ics;

...

RegistryKey key = Registry.Curren tUser.OpenSubKe y("Software\\xx x\\yyy\\")

end everything works normally..

Problem description:
----------------------
I am trying to implement the same functionality on another app and I am receiving following error:
'HEUpdate.Regis try' 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.Curre ntUser.OpenSubK ey("Software\\x xx\\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*******@cana da.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.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.Curre ntUser.OpenSubK ey("Software\\x xx\\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
7331
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 the ups and downs of registry versus files but i can´t find it now. Can someone please help me? Thanks in advance! /Bobby
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.
3
3061
by: Slimo | last post by:
Hello, I'm searching some example of code (VB) for reading remote registry subkeys and keys. Thanks
2
1965
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); RegistryKey regFamily = regSoftware.OpenSubKey("MyCompany", true); RegistryKey regApp = regFamily.OpenSubKey("MySystem", true); RegistryKey regSet = regApp.OpenSubKey("Set0", true); m_strDSN = (string) regSet.GetValue("DSN", m_strDSN); The string value...
3
1535
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, but not listed in my code. I checked under the HKEY_USERS Key there are many users listed. and each have a Software entry. The list i get through my ASPCode belongs to one of the user. But the entry i a m seeking is under a different User.
7
1210
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 logged in as a limited user can read and write to with out any need to alter the key's security or elevate the users privilages?
4
3234
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
3034
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 from this key using RegEdt32. Now i tried to set the accessrights by my programm. Since i do not have rights to this key, i cannot open the key to get a handle for modifying the rights.
2
2095
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 = registryKeyParent.OpenSubKey(subKey); it's running in windows xp. but when we try to run this application in windows vista
3
1648
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 "Local System." Thus, I can't rely on it always being ...\<Username>\Local Settings\Temp. So, this partially applies to C#, because I'll need to do this in C# code. But, I think I already know how to do it. What I don't know is where to find...
0
9720
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
9599
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,...
1
10374
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,...
0
10112
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
9193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
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
5546
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...
2
3854
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
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.