corelibraries-devexpress-dot-data-dot-utils-dot-clipboardaccesspolicy-dot-failedeventargs-4de1150e.md
Gets or sets whether to throw an exception.
Namespace : DevExpress.Data.Utils
Assembly : DevExpress.Data.Desktop.v25.2.dll
NuGet Packages : DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design
public bool Throw { get; set; }
Public Property [Throw] As Boolean
| Type | Description |
|---|---|
| Boolean |
true to throw an exception; otherwise, false.
|
The following example demonstrates how to suppress an internal exception and display a message box:
using System;
using System.Windows.Forms;
using DevExpress.Data.Utils;
using DevExpress.XtraEditors;
namespace DXApplication11 {
internal static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
ClipboardAccessPolicy.ThrowAlways();
ClipboardAccessPolicy.Failed += ClipboardAccessPolicy_Failed;
Application.Run(new Form1());
}
private static void ClipboardAccessPolicy_Failed(object sender, ClipboardAccessPolicy.FailedEventArgs e) {
e.Throw = false;
XtraMessageBox.Show(String.Format("{0} operation is not allowed.", e.Operation.ToString()), "Warning");
}
}
}
Imports System
Imports System.Windows.Forms
Imports DevExpress.Data.Utils
Imports DevExpress.XtraEditors
Namespace DXApplication11
Friend Module Program
''' <summary>
''' The main entry point for the application.
''' </summary>
<STAThread>
Sub Main()
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
ClipboardAccessPolicy.ThrowAlways()
AddHandler ClipboardAccessPolicy.Failed, AddressOf ClipboardAccessPolicy_Failed
Application.Run(New Form1())
End Sub
Private Sub ClipboardAccessPolicy_Failed(ByVal sender As Object, ByVal e As ClipboardAccessPolicy.FailedEventArgs)
e.Throw = False
XtraMessageBox.Show(String.Format("{0} operation is not allowed.", e.Operation.ToString()), "Warning")
End Sub
End Module
End Namespace
Read the following topic for additional information: Clipboard Access Policy.
See Also
ClipboardAccessPolicy.FailedEventArgs Class