TypeValidationEventArgs TypeValidationEventArgs TypeValidationEventArgs TypeValidationEventArgs Class

定义

TypeValidationCompleted 事件提供数据。Provides data for the TypeValidationCompleted event.

public ref class TypeValidationEventArgs : EventArgs
public class TypeValidationEventArgs : EventArgs
type TypeValidationEventArgs = class
    inherit EventArgs
Public Class TypeValidationEventArgs
Inherits EventArgs
继承
TypeValidationEventArgsTypeValidationEventArgsTypeValidationEventArgsTypeValidationEventArgs

示例

下面的代码示例演示如何使用此类型。The following code example demonstrates the use of this type. 在示例中,事件处理程序报告的匹配项TypeValidationCompleted事件。In the example, an event handler reports on the occurrence of the TypeValidationCompleted event. 此报告可帮助您了解事件发生的并可以帮助您进行调试。This report helps you to learn when the event occurs and can assist you in debugging. 若要报告或频繁发生的事件上多个事件,请考虑更换ShowConsole.WriteLine或将消息附加到多行TextBoxTo report on multiple events or on events that occur frequently, consider replacing Show with Console.WriteLine or appending the message to a multiline TextBox.

若要运行此代码示例,请将其粘贴到包含类型的实例的项目MaskedTextBox名为MaskedTextBox1To run the example code, paste it into a project that contains an instance of type MaskedTextBox named MaskedTextBox1. 然后,确保事件处理程序相关联TypeValidationCompleted事件。Then ensure that the event handler is associated with the TypeValidationCompleted event.

private void MaskedTextBox1_TypeValidationCompleted(Object sender, TypeValidationEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "IsValidInput", e.IsValidInput );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Message", e.Message );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ReturnValue", e.ReturnValue );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ValidatingType", e.ValidatingType );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "TypeValidationCompleted Event" );
}
Private Sub MaskedTextBox1_TypeValidationCompleted(sender as Object, e as TypeValidationEventArgs) _ 
     Handles MaskedTextBox1.TypeValidationCompleted

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "Cancel", e.Cancel)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "IsValidInput", e.IsValidInput)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Message", e.Message)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ReturnValue", e.ReturnValue)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ValidatingType", e.ValidatingType)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"TypeValidationCompleted Event")

End Sub

注解

TypeValidationCompleted事件发生时MaskedTextBox控件执行可选类型验证。The TypeValidationCompleted event occurs when a MaskedTextBox control performs optional type validation. 类型验证时才会发生时MaskedTextBox.ValidatingType属性不是null和因果操作发生,如MaskedTextBox失去焦点的控件。Type validation occurs only when the MaskedTextBox.ValidatingType property is not null and a causal action occurs, such as the MaskedTextBox control losing focus. 键入验证是指将格式化的输入的字符串转换为表示的类型的能力ValidatingType属性。Type validation is the ability to convert the formatted input string to the type represented by the ValidatingType property. 有关类型验证过程的详细信息,请参阅TypeValidationCompleted事件。For more information about the type validation process, see the TypeValidationCompleted event.

如果事件处理程序实现的TypeValidationCompleted,该处理程序接收类型的参数TypeValidationEventArgsIf an event handler is implemented for TypeValidationCompleted, the handler receives a parameter of type TypeValidationEventArgs. 此参数包含有关事件,如类型转换过程是否成功、 验证类型和等等的信息。This parameter contains information about the event, such as whether the type conversion process succeeded, the validating type, and so on.

构造函数

TypeValidationEventArgs(Type, Boolean, Object, String) TypeValidationEventArgs(Type, Boolean, Object, String) TypeValidationEventArgs(Type, Boolean, Object, String) TypeValidationEventArgs(Type, Boolean, Object, String)

初始化 TypeValidationEventArgs 类的新实例。Initializes a new instance of the TypeValidationEventArgs class.

属性

Cancel Cancel Cancel Cancel

获取或设置指示是否应取消事件的值。Gets or sets a value indicating whether the event should be canceled.

IsValidInput IsValidInput IsValidInput IsValidInput

获取一个值,该值指示格式化输入字符串是否成功转换为验证类型。Gets a value indicating whether the formatted input string was successfully converted to the validating type.

Message Message Message Message

获取描述转换过程的文本消息。Gets a text message describing the conversion process.

ReturnValue ReturnValue ReturnValue ReturnValue

获取格式化输入字符串转换所生成的对象。Gets the object that results from the conversion of the formatted input string.

ValidatingType ValidatingType ValidatingType ValidatingType

获取格式化输入字符串的验证目标类型。Gets the type that the formatted input string is being validated against.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于

另请参阅