RegistryAccessPolicy.SetValue Event
Fires when the DevExpress control attempts to write a value to a system registry key and allows you to cancel the operation.
Namespace: DevExpress.Data.Utils
Assembly: DevExpress.Data.Desktop.v24.2.dll
Declaration
Event Data
The SetValue event's data class is RegistryAccessPolicy.ValueEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cancel | Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs. |
Hive | Gets a registry hive (a logical group of keys, subkeys, and values in the registry). Inherited from RegistryAccessPolicy.RegistryOperationBaseEventArgs. |
Key | Gets the requested registry key. Inherited from RegistryAccessPolicy.RegistryOperationBaseEventArgs. |
Name | Gets the name of the value stored in a registry key. |
Operation | Gets an operation on a key value in the system registry. |
Remarks
Set the e.Cancel
event parameter to true to cancel the operation. e.Hive
, e.Key
, and e.Name
event parameters identify a registry hive, key, and name respectively.
The following example suppresses attempts to write values to the specified system registry path:
static string privatePath = "SPECIFY_REGISTRY_PRIVATE_PATH";
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
DevExpress.Data.Utils.RegistryAccessPolicy.SetValue += RegistryAccessPolicy_SetValue;
Application.Run(new Form1());
}
static void RegistryAccessPolicy_QueryValue(object sender, DevExpress.Data.Utils.RegistryAccessPolicy.ValueEventArgs e) {
e.Cancel = e.Key.Contains(privatePath);
}
Read the following topic for additional information: Registry Access Policy.
See Also