Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

BaseEdit.DefaultErrorIcon Property

Gets or sets the default error icon.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

[DXCategory("Appearance")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static Image DefaultErrorIcon { get; set; }

#Property Value

Type Description
Image

A Image object that specifies the default error icon.

#Remarks

You can display an error icon next to an editor to indicate that the editor value is not valid. The default Default Error Icon icon is displayed to the left of the editor.

Customize the Default Error Icon

Use the static (Shared in VB) DefaultErrorImageOptions property to access options that allow you to customize the error icon for all editors:

Image/SvgImage
Specifies a custom image used as an error icon.
Alignment
Specifies image alignment relatively to the editor.

Note

Specify these properties before editor initialization (in the Main method). Editors do not react to subsequent changes.

static void Main() {
  BaseEdit.DefaultErrorImageOptions.SvgImage = Properties.Resources.errorIcon;
  BaseEdit.DefaultErrorImageOptions.Alignment = ErrorIconAlignment.BottomRight;

  Application.EnableVisualStyles();
  Application.SetCompatibleTextRenderingDefault(false);
  Application.Run(new Form1());
}

Customize the Error Icon for an Individual Editor

Use an editor’s ErrorImageOptions property to access the following options:

Image/SvgImage
Specifies a custom image used as an error icon.
Alignment
Specifies image alignment relatively to the editor.

Individual editor settings have priority over DefaultErrorImageOptions settings.

public Form1() {
  InitializeComponent();
  textEdit1.ErrorImageOptions.SvgImage = svgImageCollection1["error"];
  textEdit1.ErrorImageOptions.Alignment = ErrorIconAlignment.TopLeft;
}

Customize Error Tooltip Text

Use the ErrorText property to specify error tooltip text for a standalone editor. If you use an editor in a data-aware control, use the parent control’s ValidatingEditor event to validate the editor value and display an error icon. Read the following help topic for more information: Manage user Input.


Tip

For information on how to validate editor values, read the following help topic: Validation.

See Also