RegistryAccessPolicy.Failed Event
In This Article
Allows you to respond to associated failures.
Namespace: DevExpress.Data.Utils
Assembly: DevExpress.Data.Desktop.v24.2.dll
NuGet Packages: DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design
#Declaration
public static event EventHandler<RegistryAccessPolicy.FailedEventArgs> Failed
#Event Data
The Failed event's data class is RegistryAccessPolicy.FailedEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Exception | Gets the exception. |
Operation | Gets the registry operation being processed. |
Throw | Gets or sets whether to throw an exception. |
#Remarks
The Failed
event occurs when the RegistryAccessPolicy
throws an exception and allows you to respond to the associated failure:
using DevExpress.Data.Utils;
using DevExpress.Data.Utils.Registry.Internal;
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
RegistryAccessPolicy.ThrowAlways();
RegistryAccessPolicy.Failed += RegistryAccessPolicy_Failed;
Application.Run(new Form1());
}
static void RegistryAccessPolicy_Failed(object sender, RegistryAccessPolicy.FailedEventArgs e) {
if(e.Operation == RegistryOperation.QueryValue || e.Operation == RegistryOperation.EnumerateSubKeyTree) {
e.Throw = false;
}
}
Tip
- Throw
Always() – Throws an exception when the control accesses the system registry. - Throw
On – Throws an exception if a request to the system registry fails.Errors()
Read the following topic for additional information: Registry Access Policy.
See Also