PDA

View Full Version : Using VARS in Registry.GetValue


brianlesker
10-04-2004, 10:04 AM
Why doesn't the following work:


strInstallType = "les";

strProgrammatuurCopy1 = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\Impulse\\User\\"..strInstallType, "prog_loc1", true);


:huh

JXBURNS
10-04-2004, 12:16 PM
The assumption being that:

HKEY_LOCAL_MACHINE\\Software\\Impulse\\User\\les

has a value of "prog_loc1" in the registry?

I would suggest have a Application.GetLastError in there somewhere to find out what happened. Are you sure the key exists otherwise it will return an empty string.

John

brianlesker
10-05-2004, 01:59 AM
Yeah, registy value exists, registry-dump:

[HKEY_LOCAL_MACHINE\SOFTWARE\Impulse\User\prod]
"db_naam"="whoesh"
"db_versie"="4403"
"db_update"="FALSE"
"help_versie"="FALSE"
"prog_loc1"="J:\\au-test\\user"

Application.GetLastError(); return 0 :yes

Laslie Toth
10-05-2004, 02:26 AM
[HKEY_LOCAL_MACHINE\SOFTWARE\Impulse\User\prod] but you wrote strInstallType = "les";
:rolleyes

brianlesker
10-05-2004, 02:27 AM
les & prod are both avaible, sorry for the incorrect example :)

But both value's exist!

JXBURNS
10-05-2004, 02:46 AM
What happens if you do not assign "les" to a variable but include it directly as part of the Registry.GetValue command directly?

John

brianlesker
10-05-2004, 02:49 AM
Then i get my registry value. Stupid he?

JXBURNS
10-05-2004, 02:51 AM
Also just to confirm you are running as Admin-equivalent if on a NT-based system although can't see why that would make a difference if it works this way?

I'll have a quick test in a moment with your example registry section and see if I can replicate. Watch this space.

John

brianlesker
10-05-2004, 03:00 AM
pfff! i'm to stupid, i didn't saw a fault from all my debugging code.

I have resolved the problem.

That's me, to stupid. :)

Sorry....nuf said.

JXBURNS
10-05-2004, 03:02 AM
OK as I was about to say my test worked fine.

John