Skip to main content
All docs
V25.1
  • ClipboardAccessPolicy.FailedEventArgs.Throw Property

    Gets or sets whether to throw an exception.

    Namespace: DevExpress.Data.Utils

    Assembly: DevExpress.Data.Desktop.v25.1.dll

    NuGet Packages: DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design

    Declaration

    public bool Throw { get; set; }

    Property Value

    Type Description
    Boolean

    true to throw an exception; otherwise, false.

    Remarks

    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");
            }
        }
    }
    

    Read the following topic for additional information: Clipboard Access Policy.

    See Also