Windows system registry string problems.

Hey all,

I'm BRAND-NEW to Visual Basic, so please be gentle.

I'm writing a small application which stores its values to the Windows Registry under HKEY_LOCAL_MACHINE. I can store True/False variables just fine, using code such as:

My.Computer.Registry.SetValue(keySoftwareSettings, "DisableToolStripMenuItem.Enabled", DisableToolStripMenuItem.Enabled)

I can then retreive this variable upon load with:

DisableToolStripMenuItem.Enabled = My.Computer.Registry.GetValue(keySoftwareSettings, "DisableToolStripMenuItem.Enabled", True)

The problem comes when I try to save a text variable. For example, the information stored in a standard text box. Nothing gets stored at all in the registry. The correct key type gets created, but nothing ever gets put into the registry. I'm using:

My.Computer.Registry.SetValue(keySoftwareSettings, "varTime.Text", varTime.Text) to store the variable.

What is the 'correct' way to do this sort of thing Note that I'm using this method as opposed to SaveSettings because I need all the variables to remain the same between all possible users on a given system. Also, the keySoftwareSettings variable above translates to HKEY_LOCAL_MACHINE\SOFTWARE\MY-PROGRAM\CURRENT SETTINGS if it matters.

Thanks!



Answer this question

Windows system registry string problems.

  • JBA123

    As it turns out, once I rebooted the computer I was working from, everything started working just fine.

    Don't know what the deal was to begin with.


  • Windows system registry string problems.