Click here to Skip to main content
15,914,416 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to share Entriprise Library configuration information accross muliple projects in single solution? Pin
PIEBALDconsult10-Oct-11 2:39
mvePIEBALDconsult10-Oct-11 2:39 
QuestionWorking with .DAT file. Pin
sarang_k9-Oct-11 23:34
sarang_k9-Oct-11 23:34 
AnswerRe: Working with .DAT file. PinPopular
phil.o10-Oct-11 0:23
professionalphil.o10-Oct-11 0:23 
QuestionDynamic custom controls Pin
pravin_mun9-Oct-11 20:27
pravin_mun9-Oct-11 20:27 
AnswerRe: Dynamic custom controls Pin
Richard MacCutchan9-Oct-11 21:07
mveRichard MacCutchan9-Oct-11 21:07 
Questionnot all registry values being returned Pin
JimmyRopes9-Oct-11 20:03
professionalJimmyRopes9-Oct-11 20:03 
AnswerRe: not allregistry values being returned Pin
André Kraak9-Oct-11 20:49
André Kraak9-Oct-11 20:49 
GeneralRe: not allregistry values being returned Pin
JimmyRopes10-Oct-11 3:18
professionalJimmyRopes10-Oct-11 3:18 
Good observation about some of the entries not being REG_SZ, especially when 4 are not REG_SZ on your machine. On my machine 3 are not REG_SZ, but good observation anyway.

The one I am going for, ProductId, does have a type of REG_SZ, and I am trying to retrieve it using the following:
C#
RegistryKey HKLM = Registry.LocalMachine;
String CurrentVersionPath = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\";
String ProductId = (String)CurrentVersionKey.GetValue("ProjectId");

Which works just fine with another item that is also has a type of REG_SZ.
C#
String BuildGUID = (String)CurrentVersionKey.GetValue("BuildGUID");
Console.Write(String.Format("Registry value for {0}: {1}\n\n", "BuildGUID", BuildGUID));

Could you please try the following and see if you get all the items in CurrentVersion?
C#
using System;
using Microsoft.Win32;

namespace RegistryValues
{
    class Program
    {
        static void Main(string[] args)
        {
            RegistryKey HKLM = Registry.LocalMachine;
            String CurrentVersionPath = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\";

            RegistryKey CurrentVersionKey = HKLM.OpenSubKey(CurrentVersionPath);
            if (CurrentVersionKey == null)
            {
                Console.WriteLine("Bad CurrentVersion registry key");
                Console.Read();
                return;
            } // if (CurrentVersion == null)

            String[] names = CurrentVersionKey.GetValueNames();
            Int16 i = 0;
            foreach (String name in names)
            {
                Console.WriteLine(String.Format("{0}\t{1}", ++i, name));
            } // foreach (String name in names)
            Console.WriteLine("\n");
            HKLM.Close();
            Console.Read();
        } // static void Main(string[] args)
    } // class Program
} // namespace RegistryValues

The report of my death was an exaggeration - Mark Twain

Simply Elegant Designs JimmyRopes Designs
Think inside the box! ProActive Secure Systems

I'm on-line therefore I am.
JimmyRopes



GeneralRe: not allregistry values being returned Pin
André Kraak10-Oct-11 7:29
André Kraak10-Oct-11 7:29 
GeneralRe: not allregistry values being returned Pin
JimmyRopes10-Oct-11 15:14
professionalJimmyRopes10-Oct-11 15:14 
GeneralRe: not allregistry values being returned Pin
André Kraak10-Oct-11 22:40
André Kraak10-Oct-11 22:40 
GeneralRe: not allregistry values being returned Pin
JimmyRopes11-Oct-11 0:43
professionalJimmyRopes11-Oct-11 0:43 
Questionwaspmote c# programming (reading temperature and accelerometer) Pin
tusyukomi9-Oct-11 17:06
tusyukomi9-Oct-11 17:06 
AnswerRe: waspmote c# programming (reading temperature and accelerometer) Pin
Dave Kreskowiak9-Oct-11 17:20
mveDave Kreskowiak9-Oct-11 17:20 
AnswerRe: waspmote c# programming (reading temperature and accelerometer) Pin
BobJanova10-Oct-11 3:44
BobJanova10-Oct-11 3:44 
Questiondatetime scheduled events help please Pin
CCodeNewbie9-Oct-11 10:40
CCodeNewbie9-Oct-11 10:40 
AnswerRe: datetime scheduled events help please Pin
Pete O'Hanlon9-Oct-11 10:53
mvePete O'Hanlon9-Oct-11 10:53 
AnswerRe: datetime scheduled events help please Pin
Luc Pattyn9-Oct-11 12:11
sitebuilderLuc Pattyn9-Oct-11 12:11 
AnswerRe: datetime scheduled events help please Pin
PIEBALDconsult9-Oct-11 14:03
mvePIEBALDconsult9-Oct-11 14:03 
QuestionSelecting multiple controls by mouse Pin
teknolog1239-Oct-11 4:16
teknolog1239-Oct-11 4:16 
SuggestionRe: Selecting multiple controls by mouse Pin
André Kraak9-Oct-11 4:19
André Kraak9-Oct-11 4:19 
GeneralRe: Selecting multiple controls by mouse Pin
teknolog1239-Oct-11 4:26
teknolog1239-Oct-11 4:26 
GeneralRe: Selecting multiple controls by mouse Pin
André Kraak9-Oct-11 4:45
André Kraak9-Oct-11 4:45 
GeneralRe: Selecting multiple controls by mouse Pin
teknolog1239-Oct-11 4:51
teknolog1239-Oct-11 4:51 
AnswerRe: Selecting multiple controls by mouse Pin
BillWoodruff9-Oct-11 12:03
professionalBillWoodruff9-Oct-11 12:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.