InputPanel for WinForms帮助文档
ErrorText 属性
示例 






Gets or sets an error description string with optional HTML tags.
语法
'声明
 
<C1CategoryAttribute("行为")>
<System.ComponentModel.DefaultValueAttribute()>
<System.ComponentModel.LocalizableAttribute(True)>
<System.ComponentModel.EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="C1.Win.C1InputPanel.Design.ToolTipEditor, C1.Win.C1InputPanel.2, Version=2.0.20141.179, Culture=neutral, PublicKeyToken=79882d576c6336da")>
<C1DescriptionAttribute("带有可选HTML标记的错误描述字符串。")>
Public Overridable Property ErrorText As System.String
'用法
 
Dim instance As InputComponent
Dim value As System.String
 
instance.ErrorText = value
 
value = instance.ErrorText
[C1Category("行为")]
[System.ComponentModel.DefaultValue()]
[System.ComponentModel.Localizable(true)]
[System.ComponentModel.Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="C1.Win.C1InputPanel.Design.ToolTipEditor, C1.Win.C1InputPanel.2, Version=2.0.20141.179, Culture=neutral, PublicKeyToken=79882d576c6336da")]
[C1Description("带有可选HTML标记的错误描述字符串。")]
public virtual System.string ErrorText {get; set;}
public read-write property ErrorText: System.String; virtual; 
C1CategoryAttribute("行为")
System.ComponentModel.DefaultValueAttribute()
System.ComponentModel.LocalizableAttribute()
System.ComponentModel.EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="C1.Win.C1InputPanel.Design.ToolTipEditor, C1.Win.C1InputPanel.2, Version=2.0.20141.179, Culture=neutral, PublicKeyToken=79882d576c6336da")
C1DescriptionAttribute("带有可选HTML标记的错误描述字符串。")
public function get,set ErrorText : System.String
[C1Category("行为")]
[System.ComponentModel.DefaultValue()]
[System.ComponentModel.Localizable(true)]
[System.ComponentModel.Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="C1.Win.C1InputPanel.Design.ToolTipEditor, C1.Win.C1InputPanel.2, Version=2.0.20141.179, Culture=neutral, PublicKeyToken=79882d576c6336da")]
[C1Description("带有可选HTML标记的错误描述字符串。")]
public: __property virtual System.string* get_ErrorText();
public: __property virtual void set_ErrorText( 
   System.string* value
);
[C1Category("行为")]
[System.ComponentModel.DefaultValue()]
[System.ComponentModel.Localizable(true)]
[System.ComponentModel.Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="C1.Win.C1InputPanel.Design.ToolTipEditor, C1.Win.C1InputPanel.2, Version=2.0.20141.179, Culture=neutral, PublicKeyToken=79882d576c6336da")]
[C1Description("带有可选HTML标记的错误描述字符串。")]
public:
virtual property System.String^ ErrorText {
   System.String^ get();
   void set (    System.String^ value);
}
备注

Setting this property to a non-empty string causes the component to be highlighted. The message is displayed as a tooltip when the user moves the mouse over the component.

Setting this property to an empty string removes the higlight and restores the original tooltip text (ToolTipText).

示例
The example below uses the Validating event to set the error property on an InputNumericBox when the value entered is not an even number.
private void inputNumericBox1_Validating(object sender, CancelEventArgs e)
{
    if (inputNumericBox1.Value % 2 != 0)
    {
        inputNumericBox1.ErrorText = 
            "Please enter an <b>even</b> number!";
        e.Cancel = true;
    }
    else
    {
        inputNumericBox1.ErrorText = string.Empty;
    }
}
需求

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

请参见

引用

InputComponent 类
InputComponent 成员

Send Feedback