corelibraries-devexpress-dot-data-dot-utils-dot-registryaccesspolicy-77adce3a.md
Allows you to respond to associated failures.
Namespace : DevExpress.Data.Utils
Assembly : DevExpress.Data.Desktop.v25.2.dll
NuGet Packages : DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design
public static event EventHandler<RegistryAccessPolicy.FailedEventArgs> Failed
Public Shared Event Failed As EventHandler(Of RegistryAccessPolicy.FailedEventArgs)
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. |
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;
}
}
Imports DevExpress.Data.Utils
Imports DevExpress.Data.Utils.Registry.Internal
<STAThread>
Shared Sub Main()
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
RegistryAccessPolicy.ThrowAlways()
AddHandler RegistryAccessPolicy.Failed, AddressOf RegistryAccessPolicy_Failed
Application.Run(New Form1())
End Sub
Shared Sub RegistryAccessPolicy_Failed(ByVal sender As Object, ByVal e As RegistryAccessPolicy.FailedEventArgs)
If e.Operation = RegistryOperation.QueryValue OrElse e.Operation = RegistryOperation.EnumerateSubKeyTree Then
e.Throw = False
End If
End Sub
Tip
Read the following topic for additional information: Registry Access Policy.
See Also