Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:
I am trying to retrieve Every visit to the page value using it's registry but i am unable to retrieve the value, so please help me in resolving this issue.

My code is

C#
RegistryKey reg = Registry.LocalMachine.OpenSubKey(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings \vSyncMode5 \t REG_DWORD \d 3 \f
", true);
    string currentKey;
    currentKey = reg.GetValue("Isregistered", true).ToString();
    if (currentKey == "yes")
    {
        Label1.Text = currentKey;
    }
    else
    {
        Label1.Text = currentKey;
       // Console.WriteLine("Not availble");
    }


i am getting object refrence not set to an intsance of an object, so please help me in resolving the problem.
Posted
Updated 19-Dec-13 22:38pm
v2
Comments
Reiss 20-Dec-13 4:10am    
I am assuming that the reg object is not set, which means that it hasn't found the key at the path you have specified.
Richard MacCutchan 20-Dec-13 4:40am    
Your key string looks wrong. What are all the strange characters at the end?
agent_kruger 20-Dec-13 8:22am    
what value do you want from registry?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900