TechNet
Export (0) Print
Expand All

ErrorProvider Class

 

Provides a user interface for indicating that a control on a form has an error associated with it.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      System.Windows.Forms.ErrorProvider

[<ComplexBindingPropertiesAttribute("DataSource", "DataMember")>]
type ErrorProvider = 
    class
        inherit Component
        interface IExtenderProvider
        interface ISupportInitialize
    end

NameDescription
System_CAPS_pubmethodErrorProvider()

Initializes a new instance of the ErrorProvider class and initializes the default settings for BlinkRate, BlinkStyle, and the Icon.

System_CAPS_pubmethodErrorProvider(ContainerControl)

Initializes a new instance of the ErrorProvider class attached to a container.

System_CAPS_pubmethodErrorProvider(IContainer)

Initializes a new instance of the ErrorProvider class attached to an IContainer implementation.

NameDescription
System_CAPS_pubpropertyBlinkRate

Gets or sets the rate at which the error icon flashes.

System_CAPS_pubpropertyBlinkStyle

Gets or sets a value indicating when the error icon flashes.

System_CAPS_protpropertyCanRaiseEvents

Gets a value indicating whether the component can raise an event.(Inherited from Component.)

System_CAPS_pubpropertyContainer

Gets the IContainer that contains the Component.(Inherited from Component.)

System_CAPS_pubpropertyContainerControl

Gets or sets a value indicating the parent control for this ErrorProvider.

System_CAPS_pubpropertyDataMember

Gets or sets the list within a data source to monitor.

System_CAPS_pubpropertyDataSource

Gets or sets the data source that the ErrorProvider monitors.

System_CAPS_protpropertyDesignMode

Gets a value that indicates whether the Component is currently in design mode.(Inherited from Component.)

System_CAPS_protpropertyEvents

Gets the list of event handlers that are attached to this Component.(Inherited from Component.)

System_CAPS_pubpropertyIcon

Gets or sets the Icon that is displayed next to a control when an error description string has been set for the control.

System_CAPS_pubpropertyRightToLeft

Gets or sets a value that indicates whether the component is used in a locale that supports right-to-left fonts.

System_CAPS_pubpropertySite

Gets or sets the ISite of the Component.(Overrides Component.Site.)

System_CAPS_pubpropertyTag

Gets or sets an object that contains data about the component.

NameDescription
System_CAPS_pubmethodBindToDataAndErrors(Object, String)

Provides a method to set both the DataSource and DataMember at run time.

System_CAPS_pubmethodCanExtend(Object)

Gets a value indicating whether a control can be extended.

System_CAPS_pubmethodClear()

Clears all settings associated with this component.

System_CAPS_pubmethodCreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodDispose()

Releases all resources used by the Component.(Inherited from Component.)

System_CAPS_protmethodDispose(Boolean)

Releases the unmanaged resources used by the Component and optionally releases the managed resources.(Overrides Component.Dispose(Boolean).)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.(Inherited from Component.)

System_CAPS_pubmethodGetError(Control)

Returns the current error description string for the specified control.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetIconAlignment(Control)

Gets a value indicating where the error icon should be placed in relation to the control.

System_CAPS_pubmethodGetIconPadding(Control)

Returns the amount of extra space to leave next to the error icon.

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodGetService(Type)

Returns an object that represents a service provided by the Component or by its Container.(Inherited from Component.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodOnRightToLeftChanged(EventArgs)

Raises the RightToLeftChanged event.

System_CAPS_pubmethodSetError(Control, String)

Sets the error description string for the specified control.

System_CAPS_pubmethodSetIconAlignment(Control, ErrorIconAlignment)

Sets the location where the error icon should be placed in relation to the control.

System_CAPS_pubmethodSetIconPadding(Control, Int32)

Sets the amount of extra space to leave between the specified control and the error icon.

System_CAPS_pubmethodToString()

Returns a String containing the name of the Component, if any. This method should not be overridden.(Inherited from Component.)

System_CAPS_pubmethodUpdateBinding()

Provides a method to update the bindings of the DataSource, DataMember, and the error text.

NameDescription
System_CAPS_pubeventDisposed

Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)

System_CAPS_pubeventRightToLeftChanged

Occurs when the RightToLeft property changes value.

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodISupportInitialize.BeginInit()

Signals the object that initialization is starting.

System_CAPS_pubinterfaceSystem_CAPS_privmethodISupportInitialize.EndInit()

Signals the object that initialization is complete.

ErrorProvider presents a simple mechanism for indicating to the end user that a control on a form has an error associated with it. If an error description string is specified for the control, an icon appears next to the control. The icon flashes in the manner specified by BlinkStyle, at the rate specified by BlinkRate. When the mouse hovers over the icon, a ToolTip appears showing the error description string.

Typically, you use ErrorProvider in association with data-bound controls. When using ErrorProvider with data-bound controls, you must specify the ContainerControl, either in the constructor or by setting the ContainerControl property.

System_CAPS_noteNote

The ErrorProvider component does not provide built-in support for accessibility clients. To make your application accessible when using this component, you must provide an additional, accessible feedback mechanism.

The following code example demonstrates using the ErrorProvider class to notify the user of a data entry error. The example creates a Form that contains a TextBox control, a NumericUpDown control, and a ComboBox control, each validating its content, and an ErrorProvider for each control. The example sets error icon options using the BlinkRate and BlinkStyle properties and the SetIconAlignment and SetIconPadding methods. The SetError method is called with or without appropriate error text during a control’s Validated event, depending upon the content in the control.

No code example is currently available or this language may not be supported.

The following code example shows how to use the ErrorProvider with a DataSource and DataMember to indicate a data error to the user.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft