| Parameter | Description |
|---|---|
| sSubKey | The name of an optional subkey |
| sValueName | The name of the Value to check the existence of |
True, if the Value exists. If the Value doesn't exist, then False is returned.
Function ValueExists string sSubKey string sValueName Returns Boolean
| Call: | Get ValueExists sSubKey sValueName to BooleanVariable |
Before you attempt to read a value from the Registry, you should ensure that it exists. Use this function to verify that a Value exists before trying to read it.
The base key that will be used is that returned by RegistryKeyString and you can specify a further subkey using the sSubKey parameter. The sValueName parameter is the name of the Value to check for existence.
For example, assume that you wanted to read some preferences (which you had previously written) from the Registry at the start of your program. The "name" value is stored in the base key of your application; the "ShowCustomerView" value is stored under the "Preferences" subkey of your application. This is how you would check and retrieve the data:
Use cApplication.pkg
Object oApplication Is A cApplication
Procedure OnCreate
String sName
Boolean bShowCustomerView
If (ValueExists(Self, "", "Name")) ;
Get ReadString "" "Name" to sName
If (ValueExists(Self, "Preferences" "ShowCustomerView")) ;
Get ReadInteger "Preferences" "ShowCustomerViews" to bShowCustomerView
Send DoOpenWorkspace "MyApp"
End_Procedure
End_Object