Results 1 to 2 of 2

Thread: LastKey in Registry

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    181

    LastKey in Registry

    Hey.. I'm trying to make a lastkey thing for the registry editor so that it will open right to a specific key.. here's hwat I have so far.. but it wont work. I get an 'object reference not set to an instance of an object' error.



    VB Code:
    1. Dim test As RegistryKey
    2.             test= Registry.CurrentUser.OpenSubKey("\\Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Regedit\\", True)
    3.             test.SetValue("lastkey", "Test")
    4.             Shell("regedit")

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: LastKey in Registry

    Why are you trying to escape your backslashes? You don't do that in VB.NET, so it may well be interpreting the double backslashes as a subkey of a key with no name, which would always return Nothing. Also, I don't think you need to start the string with a backslash either.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width