Solved

Get Registry Type with C#

Posted on 2009-05-07
4
704 Views
Last Modified: 2013-12-17
I need to retrieve the Registry Type (e.g. REG_SZ) with C#

Any idea how to get this data?
0
Comment
Question by:schubduese
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:Anthony408
ID: 24331806
Hi schubduese,

I am not quite sure what you mean by Registry Type, but here are some useful C# Registry Links that might point you in the right direction.

C# Registry Basics:
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=264

Registry In's and Out's Using C#:
http://www.csharphelp.com/archives2/archive430.html

Read, write and delete from registry with C#"
http://www.codeproject.com/KB/system/modifyregistry.aspx

Sorry if this is not what you are looking for.

-Anthony
0
 
LVL 5

Accepted Solution

by:
rendaduiyan earned 500 total points
ID: 24332681
RegistryValueKind rvk = rkRoot.OpenSubKey(yourkey).GetValueKind(yourkey).
get details with GetValueKind from msdn.
0
 

Author Comment

by:schubduese
ID: 24333800
rendaduiyan, I think you mean .GetValueKind(yourvaluename)

With this, it works... it reports for example "String"
That means I have to change it like this:
private String mValType = String.Empty;
 
switch (rvk.ToString())
{
    case "String":
        mValType = "REG_SZ";
        break;
    ...
    ...
 
}

Open in new window

0
 
LVL 5

Expert Comment

by:rendaduiyan
ID: 24333954
the returned value is a enum,
RegistryValueKind:
String, REG_SZ
ExpandString, REG_EXPAND_SZ
Binary, REG_BINARY
DWord, REG_DWORD
MultiString, REG_MULTI_SZ
QWord, REG_QWORD
Unknown

It is easy for you to handle the enum.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question