Click here to Skip to main content
15,898,538 members
Home / Discussions / C#
   

C#

 
QuestionInfragistics UltraWinGrid control Pin
umashankergr88-Oct-07 8:18
umashankergr88-Oct-07 8:18 
JokeRe: Infragistics UltraWinGrid control Pin
karthick.n.mca8-Oct-07 21:09
karthick.n.mca8-Oct-07 21:09 
GeneralRe: Infragistics UltraWinGrid control Pin
umashankergr89-Oct-07 0:27
umashankergr89-Oct-07 0:27 
QuestionCheck Registry for Key Pin
andyr20058-Oct-07 7:33
andyr20058-Oct-07 7:33 
AnswerRe: Check Registry for Key [modified] Pin
Kristian Sixhøj8-Oct-07 7:41
Kristian Sixhøj8-Oct-07 7:41 
AnswerRe: Check Registry for Key Pin
Guffa8-Oct-07 7:42
Guffa8-Oct-07 7:42 
GeneralRe: Check Registry for Key Pin
andyr20058-Oct-07 8:00
andyr20058-Oct-07 8:00 
GeneralRe: Check Registry for Key Pin
Scott Dorman8-Oct-07 8:35
professionalScott Dorman8-Oct-07 8:35 
There are a few things wrong with this code that would be answered if you look at the MSDN documentation[^].

First of all, to retrieve the unnamed value (which is displayed in the registry editor as the string "(Default)", you need to use either a null reference (Nothing in Visual Basic) or the empty string ("") for name (the first parameter).

Second, the GetValue method actually returns an object, so you should cast the result to a string.

Third, registry access makes use of unmanaged resources, so you should dispose/close the keys when you are done with them.

Fourth, you should probably be doing culture aware, case insensitive string comparisons.

You're code should look something like this:
C#
using (RegistryKey rk = Registry.ClassesRoot.OpenSubKey("Directory\\Background\\shellex\\ContextMenuHandlers", false))
{
   string aticcc = (string)rk.GetValue(String.Empty, "Not Installed");
   if (String.Compare(aticcc, "Not Installed", StringComparison.CurrentCultureIgnoreCase) == 0)
      ultraGroupBoxDisplayRightClickTwoChildOne.Enabled = false;
}



Scott.

—In just two days, tomorrow will be yesterday.

[Forum Guidelines] [Articles] [Blog]

GeneralRe: Check Registry for Key Pin
Anthony Mushrow8-Oct-07 8:37
professionalAnthony Mushrow8-Oct-07 8:37 
GeneralRe: Check Registry for Key Pin
andyr20058-Oct-07 9:06
andyr20058-Oct-07 9:06 
GeneralRe: Check Registry for Key Pin
Scott Dorman8-Oct-07 9:13
professionalScott Dorman8-Oct-07 9:13 
GeneralRe: Check Registry for Key Pin
andyr20058-Oct-07 9:24
andyr20058-Oct-07 9:24 
GeneralRe: Check Registry for Key Pin
Scott Dorman8-Oct-07 9:47
professionalScott Dorman8-Oct-07 9:47 
GeneralRe: Check Registry for Key Pin
andyr20058-Oct-07 10:06
andyr20058-Oct-07 10:06 
GeneralRe: Check Registry for Key Pin
Scott Dorman8-Oct-07 10:13
professionalScott Dorman8-Oct-07 10:13 
QuestionHttpwebrequest 0 cookies from any site?? Pin
atj8858-Oct-07 7:32
atj8858-Oct-07 7:32 
AnswerRe: Httpwebrequest 0 cookies from any site?? Pin
Guffa8-Oct-07 7:47
Guffa8-Oct-07 7:47 
GeneralRe: Httpwebrequest 0 cookies from any site?? Pin
atj8858-Oct-07 8:18
atj8858-Oct-07 8:18 
GeneralRe: Httpwebrequest 0 cookies from any site?? Pin
Guffa8-Oct-07 9:50
Guffa8-Oct-07 9:50 
GeneralRe: Httpwebrequest 0 cookies from any site?? Pin
Pete O'Hanlon8-Oct-07 10:13
mvePete O'Hanlon8-Oct-07 10:13 
GeneralRe: Httpwebrequest 0 cookies from any site?? Pin
atj8858-Oct-07 10:18
atj8858-Oct-07 10:18 
AnswerRe: Httpwebrequest 0 cookies from any site?? Pin
Guffa8-Oct-07 13:17
Guffa8-Oct-07 13:17 
GeneralRe: Httpwebrequest 0 cookies from any site?? Pin
atj8858-Oct-07 15:17
atj8858-Oct-07 15:17 
AnswerRe: Httpwebrequest 0 cookies from any site?? Pin
Guffa8-Oct-07 21:27
Guffa8-Oct-07 21:27 
GeneralRe: Httpwebrequest 0 cookies from any site?? Pin
Pete O'Hanlon8-Oct-07 21:56
mvePete O'Hanlon8-Oct-07 21:56 

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.