<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FGUI_Windows_Forms%2FErrorProvider</id>
		<title>Csharp/CSharp Tutorial/GUI Windows Forms/ErrorProvider - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FGUI_Windows_Forms%2FErrorProvider"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/ErrorProvider&amp;action=history"/>
		<updated>2026-04-29T21:41:23Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/ErrorProvider&amp;diff=5401&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/ErrorProvider&amp;diff=5401&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:53Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/ErrorProvider&amp;diff=5402&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/ErrorProvider&amp;diff=5402&amp;oldid=prev"/>
				<updated>2010-05-26T12:15:19Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==ErrorProvider: number must be in a range==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
public partial class Form1 : Form&lt;br /&gt;
{&lt;br /&gt;
    public Form1()&lt;br /&gt;
    {&lt;br /&gt;
        InitializeComponent();&lt;br /&gt;
    }&lt;br /&gt;
    private void numberBox_Validating(object sender, CancelEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        try&lt;br /&gt;
        {&lt;br /&gt;
            int numberEntered = int.Parse(numberBox.Text);&lt;br /&gt;
            if (numberEntered &amp;lt; 1 || numberEntered &amp;gt; 10)&lt;br /&gt;
            {&lt;br /&gt;
                e.Cancel = true;&lt;br /&gt;
                errorProvider1.SetError(numberBox, &amp;quot;You must enter a number between 1 and 10&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        catch (FormatException)&lt;br /&gt;
        {&lt;br /&gt;
            e.Cancel = true;&lt;br /&gt;
            errorProvider1.SetError(numberBox, &amp;quot;You need to enter a whole number&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    private void numberBox_Validated(object sender, EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        MessageBox.Show(&amp;quot;Well done, you managed to enter a valid number&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    private void okButton_Click(object sender, EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        this.Close();&lt;br /&gt;
    }&lt;br /&gt;
    private void numberBox_TextChanged(object sender, EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        MessageBox.Show(&amp;quot;text changed&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
partial class Form1&lt;br /&gt;
{&lt;br /&gt;
    private void InitializeComponent()&lt;br /&gt;
    {&lt;br /&gt;
        System.ruponentModel.Container components = new System.ruponentModel.Container();&lt;br /&gt;
        this.numberBox = new System.Windows.Forms.TextBox();&lt;br /&gt;
        this.label1 = new System.Windows.Forms.Label();&lt;br /&gt;
        this.okButton = new System.Windows.Forms.Button();&lt;br /&gt;
        this.errorProvider1 = new System.Windows.Forms.ErrorProvider(components);&lt;br /&gt;
        ((System.ruponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit();&lt;br /&gt;
        this.SuspendLayout();&lt;br /&gt;
        // &lt;br /&gt;
        // numberBox&lt;br /&gt;
        // &lt;br /&gt;
        this.numberBox.Location = new System.Drawing.Point(190, 12);&lt;br /&gt;
        this.numberBox.Name = &amp;quot;numberBox&amp;quot;;&lt;br /&gt;
        this.numberBox.Size = new System.Drawing.Size(44, 20);&lt;br /&gt;
        this.numberBox.TabIndex = 0;&lt;br /&gt;
        this.numberBox.Validated += new System.EventHandler(this.numberBox_Validated);&lt;br /&gt;
        this.numberBox.Validating += new System.ruponentModel.CancelEventHandler(this.numberBox_Validating);&lt;br /&gt;
        this.numberBox.TextChanged += new System.EventHandler(this.numberBox_TextChanged);&lt;br /&gt;
        // &lt;br /&gt;
        // label1&lt;br /&gt;
        // &lt;br /&gt;
        this.label1.AutoSize = true;&lt;br /&gt;
        this.label1.Location = new System.Drawing.Point(12, 15);&lt;br /&gt;
        this.label1.Name = &amp;quot;label1&amp;quot;;&lt;br /&gt;
        this.label1.Size = new System.Drawing.Size(164, 13);&lt;br /&gt;
        this.label1.TabIndex = 1;&lt;br /&gt;
        this.label1.Text = &amp;quot;Enter a number between 1 and 10&amp;quot;;&lt;br /&gt;
        // &lt;br /&gt;
        // okButton&lt;br /&gt;
        // &lt;br /&gt;
        this.okButton.Location = new System.Drawing.Point(251, 9);&lt;br /&gt;
        this.okButton.Name = &amp;quot;okButton&amp;quot;;&lt;br /&gt;
        this.okButton.Size = new System.Drawing.Size(75, 23);&lt;br /&gt;
        this.okButton.TabIndex = 2;&lt;br /&gt;
        this.okButton.Text = &amp;quot;OK&amp;quot;;&lt;br /&gt;
        this.okButton.Click += new System.EventHandler(this.okButton_Click);&lt;br /&gt;
        // &lt;br /&gt;
        // errorProvider1&lt;br /&gt;
        // &lt;br /&gt;
        this.errorProvider1.ContainerControl = this;&lt;br /&gt;
        // &lt;br /&gt;
        // Form1&lt;br /&gt;
        // &lt;br /&gt;
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);&lt;br /&gt;
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;&lt;br /&gt;
        this.ClientSize = new System.Drawing.Size(340, 47);&lt;br /&gt;
        this.Controls.Add(this.okButton);&lt;br /&gt;
        this.Controls.Add(this.label1);&lt;br /&gt;
        this.Controls.Add(this.numberBox);&lt;br /&gt;
        this.Name = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
        this.Text = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
        ((System.ruponentModel.ISupportInitialize)(this.errorProvider1)).EndInit();&lt;br /&gt;
        this.ResumeLayout(false);&lt;br /&gt;
        this.PerformLayout();&lt;br /&gt;
    }&lt;br /&gt;
    private System.Windows.Forms.TextBox numberBox;&lt;br /&gt;
    private System.Windows.Forms.Label label1;&lt;br /&gt;
    private System.Windows.Forms.Button okButton;&lt;br /&gt;
    private System.Windows.Forms.ErrorProvider errorProvider1;&lt;br /&gt;
}&lt;br /&gt;
public class ErrorProviderTextBox&lt;br /&gt;
{&lt;br /&gt;
    [STAThread]&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        Application.EnableVisualStyles();&lt;br /&gt;
        Application.Run(new Form1());&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==ErrorProvider: Text length==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Data;&lt;br /&gt;
public class ErrorForm : System.Windows.Forms.Form&lt;br /&gt;
{&lt;br /&gt;
  private System.ruponentModel.Container components = null;&lt;br /&gt;
  private System.Windows.Forms.Label label1;&lt;br /&gt;
  private System.Windows.Forms.Button btnValidate;&lt;br /&gt;
  private System.Windows.Forms.ErrorProvider errorProvider1;&lt;br /&gt;
  private System.Windows.Forms.TextBox txtInput;&lt;br /&gt;
  public ErrorForm()&lt;br /&gt;
  {&lt;br /&gt;
    InitializeComponent();&lt;br /&gt;
  }&lt;br /&gt;
  protected override void Dispose( bool disposing )&lt;br /&gt;
  {&lt;br /&gt;
    if( disposing )&lt;br /&gt;
    {&lt;br /&gt;
      if (components != null) &lt;br /&gt;
      {&lt;br /&gt;
        components.Dispose();&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    base.Dispose( disposing );&lt;br /&gt;
  }&lt;br /&gt;
  private void InitializeComponent()&lt;br /&gt;
  {&lt;br /&gt;
    this.errorProvider1 = new System.Windows.Forms.ErrorProvider();&lt;br /&gt;
    this.label1 = new System.Windows.Forms.Label();&lt;br /&gt;
    this.txtInput = new System.Windows.Forms.TextBox();&lt;br /&gt;
    this.btnValidate = new System.Windows.Forms.Button();&lt;br /&gt;
    this.SuspendLayout();&lt;br /&gt;
    // &lt;br /&gt;
    // errorProvider1&lt;br /&gt;
    // &lt;br /&gt;
    this.errorProvider1.BlinkRate = 500;&lt;br /&gt;
    this.errorProvider1.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.AlwaysBlink;&lt;br /&gt;
    this.errorProvider1.ContainerControl = this;&lt;br /&gt;
    // &lt;br /&gt;
    // label1&lt;br /&gt;
    // &lt;br /&gt;
    this.label1.Font = new System.Drawing.Font(&amp;quot;Arial Black&amp;quot;, 12F);&lt;br /&gt;
    this.label1.Location = new System.Drawing.Point(8, 8);&lt;br /&gt;
    this.label1.Name = &amp;quot;label1&amp;quot;;&lt;br /&gt;
    this.label1.Size = new System.Drawing.Size(376, 56);&lt;br /&gt;
    this.label1.TabIndex = 2;&lt;br /&gt;
    this.label1.Text = &amp;quot;The following text box only allows 5 characters.  Try to enter more...&amp;quot;;&lt;br /&gt;
    // &lt;br /&gt;
    // txtInput&lt;br /&gt;
    // &lt;br /&gt;
    this.txtInput.Location = new System.Drawing.Point(144, 80);&lt;br /&gt;
    this.txtInput.Name = &amp;quot;txtInput&amp;quot;;&lt;br /&gt;
    this.txtInput.Size = new System.Drawing.Size(120, 20);&lt;br /&gt;
    this.txtInput.TabIndex = 0;&lt;br /&gt;
    this.txtInput.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
    this.txtInput.Validating += new System.ruponentModel.CancelEventHandler(this.txtInput_Validating);&lt;br /&gt;
    // &lt;br /&gt;
    // btnValidate&lt;br /&gt;
    // &lt;br /&gt;
    this.btnValidate.Location = new System.Drawing.Point(16, 72);&lt;br /&gt;
    this.btnValidate.Name = &amp;quot;btnValidate&amp;quot;;&lt;br /&gt;
    this.btnValidate.Size = new System.Drawing.Size(112, 32);&lt;br /&gt;
    this.btnValidate.TabIndex = 1;&lt;br /&gt;
    this.btnValidate.Text = &amp;quot;OK&amp;quot;;&lt;br /&gt;
    // &lt;br /&gt;
    // ErrorForm&lt;br /&gt;
    // &lt;br /&gt;
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);&lt;br /&gt;
    this.ClientSize = new System.Drawing.Size(400, 125);&lt;br /&gt;
    this.Controls.Add(this.label1);&lt;br /&gt;
    this.Controls.Add(this.btnValidate);&lt;br /&gt;
    this.Controls.Add(this.txtInput);&lt;br /&gt;
    this.Name = &amp;quot;ErrorForm&amp;quot;;&lt;br /&gt;
    this.Text = &amp;quot;Error Trapper&amp;quot;;&lt;br /&gt;
    this.ResumeLayout(false);&lt;br /&gt;
  }&lt;br /&gt;
  [STAThread]&lt;br /&gt;
  static void Main() &lt;br /&gt;
  {&lt;br /&gt;
    Application.Run(new ErrorForm());&lt;br /&gt;
  }&lt;br /&gt;
  private void txtInput_Validating(object sender, System.ruponentModel.CancelEventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    // Check if the text length is greater than 5.&lt;br /&gt;
    if(txtInput.Text.Length &amp;gt; 5)&lt;br /&gt;
    {&lt;br /&gt;
      errorProvider1.SetError( txtInput, &amp;quot;Can&amp;quot;t be greater than 5!&amp;quot;);&lt;br /&gt;
    } &lt;br /&gt;
    else&lt;br /&gt;
      errorProvider1.SetError(txtInput, &amp;quot;&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Get ErrorMessage from ErrorProvider==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Text.RegularExpressions;&lt;br /&gt;
public class TextBoxValidationRegex : Form&lt;br /&gt;
{&lt;br /&gt;
    public TextBoxValidationRegex()&lt;br /&gt;
    {&lt;br /&gt;
        this.ruponents = new System.ruponentModel.Container();&lt;br /&gt;
        this.Button1 = new System.Windows.Forms.Button();&lt;br /&gt;
        this.errProvider = new System.Windows.Forms.ErrorProvider(this.ruponents);&lt;br /&gt;
        this.Label3 = new System.Windows.Forms.Label();&lt;br /&gt;
        this.txtEmail = new System.Windows.Forms.TextBox();&lt;br /&gt;
        ((System.ruponentModel.ISupportInitialize)(this.errProvider)).BeginInit();&lt;br /&gt;
        this.SuspendLayout();&lt;br /&gt;
        this.Button1.Location = new System.Drawing.Point(212, 80);&lt;br /&gt;
        this.Button1.Name = &amp;quot;Button1&amp;quot;;&lt;br /&gt;
        this.Button1.Size = new System.Drawing.Size(76, 24);&lt;br /&gt;
        this.Button1.TabIndex = 12;&lt;br /&gt;
        this.Button1.Text = &amp;quot;OK&amp;quot;;&lt;br /&gt;
        this.Button1.Click += new System.EventHandler(this.Button1_Click);&lt;br /&gt;
        this.errProvider.ContainerControl = this;&lt;br /&gt;
        this.errProvider.DataMember = &amp;quot;&amp;quot;;&lt;br /&gt;
        this.Label3.Location = new System.Drawing.Point(24, 24);&lt;br /&gt;
        this.Label3.Size = new System.Drawing.Size(40, 16);&lt;br /&gt;
        this.Label3.Text = &amp;quot;Email:&amp;quot;;&lt;br /&gt;
        this.txtEmail.Location = new System.Drawing.Point(68, 20);&lt;br /&gt;
        this.txtEmail.Size = new System.Drawing.Size(220, 21);&lt;br /&gt;
        this.txtEmail.Leave += new System.EventHandler(this.txtEmail_Leave);&lt;br /&gt;
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);&lt;br /&gt;
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;&lt;br /&gt;
        this.ClientSize = new System.Drawing.Size(328, 126);&lt;br /&gt;
        this.Controls.Add(this.Label3);&lt;br /&gt;
        this.Controls.Add(this.txtEmail);&lt;br /&gt;
        this.Controls.Add(this.Button1);&lt;br /&gt;
        this.Font = new System.Drawing.Font(&amp;quot;Tahoma&amp;quot;, 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));&lt;br /&gt;
        ((System.ruponentModel.ISupportInitialize)(this.errProvider)).EndInit();&lt;br /&gt;
        this.ResumeLayout(false);&lt;br /&gt;
        this.PerformLayout();&lt;br /&gt;
    }&lt;br /&gt;
    private void Button1_Click(object sender, EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        string errorText = &amp;quot;&amp;quot;;&lt;br /&gt;
        foreach (Control ctrl in this.Controls)&lt;br /&gt;
        {&lt;br /&gt;
            if (errProvider.GetError(ctrl) != &amp;quot;&amp;quot;)&lt;br /&gt;
            {&lt;br /&gt;
                errorText += &amp;quot;   * &amp;quot; + errProvider.GetError(ctrl) + &amp;quot;\n&amp;quot;;&lt;br /&gt;
                &lt;br /&gt;
            }&lt;br /&gt;
            MessageBox.Show(&amp;quot;Errors:&amp;quot; +errorText, &amp;quot;Invalid Input&amp;quot;, MessageBoxButtons.OK, MessageBoxIcon.Warning);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    private void txtEmail_Leave(object sender, EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        Regex regex;&lt;br /&gt;
        regex = new Regex(@&amp;quot;^[\w-]+@([\w-]+\.)+[\w-]+$&amp;quot;);&lt;br /&gt;
        Control ctrl = (Control)sender;&lt;br /&gt;
        if (regex.IsMatch(ctrl.Text) || ctrl.Text == &amp;quot;&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            errProvider.SetError(ctrl, &amp;quot;&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            errProvider.SetError(ctrl, &amp;quot;This is not a valid email address.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    [STAThread]&lt;br /&gt;
    public static void Main(string[] args)&lt;br /&gt;
    {&lt;br /&gt;
        Application.Run(new TextBoxValidationRegex());&lt;br /&gt;
    }&lt;br /&gt;
    private System.Windows.Forms.Button Button1;&lt;br /&gt;
    private System.Windows.Forms.ErrorProvider errProvider;&lt;br /&gt;
    private System.Windows.Forms.Label Label3;&lt;br /&gt;
    private System.Windows.Forms.TextBox txtEmail;&lt;br /&gt;
    private System.ruponentModel.IContainer components = null;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>