PDA

View Full Version : building functions if value exist- coding question


slafta
06-06-2005, 10:15 AM
scenario:
in my registry this exists:

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\W 3SVC\Parameters\Virtual Roots]
"/"="c:\\inetpub\\wwwroot,,201"


currently i was plying with:
ControlSet001root=Registry.DoesKeyExist(HKEY_LOCAL _MACHINE, "\\SYSTEM\\ControlSet001\\Services\\W3SVC\\Paramete rs\\Virtual Roots\\/");



i realized the code was wrong:
it would have to be a nested if:

ControlSet001root=Registry.DoesKeyExist(HKEY_LOCAL _MACHINE, "\\SYSTEM\\ControlSet001\\Services\\W3SVC\\Paramete rs\\Virtual Roots\\");

and
ControlSet001rootvalue= Registry.GetValue(HKEY_CURRENT_USER, "\\SYSTEM\\ControlSet001\\Services\\W3SVC\\Paramete rs\\Virtual Roots\\", "/", true);

and then if (ControlSet001root)then
if ControlSet001rootvalue ~= nil


how would be the best way to code
if value exist