<?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%2FC_Sharp%2FGUI_Windows_Form%2FValidation</id>
		<title>Csharp/C Sharp/GUI Windows Form/Validation - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FGUI_Windows_Form%2FValidation"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Validation&amp;action=history"/>
		<updated>2026-04-29T21:22:06Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Validation&amp;diff=88&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Validation&amp;diff=88&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:18Z</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/C_Sharp/GUI_Windows_Form/Validation&amp;diff=89&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Validation&amp;diff=89&amp;oldid=prev"/>
				<updated>2010-05-26T11:33:03Z</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;==Error Provider to validate the text in a TextBox==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&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.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;
      CenterToScreen();&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;
      // &lt;br /&gt;
      // label1&lt;br /&gt;
      // &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.&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.AddRange(new System.Windows.Forms.Control[] {&lt;br /&gt;
                                      this.label1,&lt;br /&gt;
                                      this.btnValidate,&lt;br /&gt;
                                      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;
    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;
      if(txtInput.Text.ToString().Length &amp;gt; 5) {&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;
    }&lt;br /&gt;
  }&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==TextBox value validation Demo==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&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 Form1 : System.Windows.Forms.Form&lt;br /&gt;
  {&lt;br /&gt;
    private System.Windows.Forms.Label lblName;&lt;br /&gt;
    private System.Windows.Forms.Label lblAddress;&lt;br /&gt;
    private System.Windows.Forms.Label lblOccupation;&lt;br /&gt;
    private System.Windows.Forms.Label lblAge;&lt;br /&gt;
    private System.Windows.Forms.Button btnOK;&lt;br /&gt;
    private System.Windows.Forms.Button btnHelp;&lt;br /&gt;
    private System.Windows.Forms.TextBox txtName;&lt;br /&gt;
    private System.Windows.Forms.TextBox txtAddress;&lt;br /&gt;
    private System.Windows.Forms.TextBox txtOccupation;&lt;br /&gt;
    private System.Windows.Forms.TextBox txtAge;&lt;br /&gt;
    public Form1()&lt;br /&gt;
    {&lt;br /&gt;
      InitializeComponent();&lt;br /&gt;
      this.btnOK.Enabled = false;&lt;br /&gt;
      this.txtAddress.Tag = false;&lt;br /&gt;
      this.txtAge.Tag = false;&lt;br /&gt;
      this.txtName.Tag = false;&lt;br /&gt;
      this.txtOccupation.Tag = false;&lt;br /&gt;
      this.txtName.Validating += new System.ruponentModel.CancelEventHandler(this.txtBoxEmpty_Validating);&lt;br /&gt;
      this.txtAddress.Validating += new System.ruponentModel.CancelEventHandler(this.txtBoxEmpty_Validating);&lt;br /&gt;
      this.txtOccupation.Validating += new System.ruponentModel.CancelEventHandler(this.txtOccupation_Validating);&lt;br /&gt;
      this.txtAge.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtAge_KeyPress);&lt;br /&gt;
      this.txtAge.Validating += new System.ruponentModel.CancelEventHandler(this.txtBoxEmpty_Validating);&lt;br /&gt;
      this.txtName.TextChanged += new System.EventHandler(this.txtBox_TextChanged);&lt;br /&gt;
      this.txtAddress.TextChanged += new System.EventHandler(this.txtBox_TextChanged);&lt;br /&gt;
      this.txtAge.TextChanged += new System.EventHandler(this.txtBox_TextChanged);&lt;br /&gt;
      this.txtOccupation.TextChanged += new System.EventHandler(this.txtBox_TextChanged);&lt;br /&gt;
    }&lt;br /&gt;
    private void InitializeComponent()&lt;br /&gt;
    {&lt;br /&gt;
      this.lblName = new System.Windows.Forms.Label();&lt;br /&gt;
      this.txtName = new System.Windows.Forms.TextBox();&lt;br /&gt;
      this.lblAge = new System.Windows.Forms.Label();&lt;br /&gt;
      this.btnOK = new System.Windows.Forms.Button();&lt;br /&gt;
      this.txtAge = new System.Windows.Forms.TextBox();&lt;br /&gt;
      this.txtAddress = new System.Windows.Forms.TextBox();&lt;br /&gt;
      this.lblAddress = new System.Windows.Forms.Label();&lt;br /&gt;
      this.lblOccupation = new System.Windows.Forms.Label();&lt;br /&gt;
      this.txtOccupation = new System.Windows.Forms.TextBox();&lt;br /&gt;
      this.btnHelp = new System.Windows.Forms.Button();&lt;br /&gt;
      this.SuspendLayout();&lt;br /&gt;
      // &lt;br /&gt;
      // lblName&lt;br /&gt;
      // &lt;br /&gt;
      this.lblName.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) &lt;br /&gt;
        | System.Windows.Forms.AnchorStyles.Left);&lt;br /&gt;
      this.lblName.Location = new System.Drawing.Point(8, 16);&lt;br /&gt;
      this.lblName.Name = &amp;quot;lblName&amp;quot;;&lt;br /&gt;
      this.lblName.Size = new System.Drawing.Size(92, 23);&lt;br /&gt;
      this.lblName.TabIndex = 0;&lt;br /&gt;
      this.lblName.Text = &amp;quot;Name&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // txtName&lt;br /&gt;
      // &lt;br /&gt;
      this.txtName.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) &lt;br /&gt;
        | System.Windows.Forms.AnchorStyles.Left) &lt;br /&gt;
        | System.Windows.Forms.AnchorStyles.Right);&lt;br /&gt;
      this.txtName.Location = new System.Drawing.Point(112, 16);&lt;br /&gt;
      this.txtName.Name = &amp;quot;txtName&amp;quot;;&lt;br /&gt;
      this.txtName.Size = new System.Drawing.Size(176, 20);&lt;br /&gt;
      this.txtName.TabIndex = 5;&lt;br /&gt;
      this.txtName.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // lblAge&lt;br /&gt;
      // &lt;br /&gt;
      this.lblAge.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) &lt;br /&gt;
        | System.Windows.Forms.AnchorStyles.Left);&lt;br /&gt;
      this.lblAge.Location = new System.Drawing.Point(8, 144);&lt;br /&gt;
      this.lblAge.Name = &amp;quot;lblAge&amp;quot;;&lt;br /&gt;
      this.lblAge.Size = new System.Drawing.Size(92, 23);&lt;br /&gt;
      this.lblAge.TabIndex = 3;&lt;br /&gt;
      this.lblAge.Text = &amp;quot;Age&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // btnOK&lt;br /&gt;
      // &lt;br /&gt;
      this.btnOK.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);&lt;br /&gt;
      this.btnOK.Location = new System.Drawing.Point(296, 16);&lt;br /&gt;
      this.btnOK.Name = &amp;quot;btnOK&amp;quot;;&lt;br /&gt;
      this.btnOK.TabIndex = 10;&lt;br /&gt;
      this.btnOK.Text = &amp;quot;OK&amp;quot;;&lt;br /&gt;
      this.btnOK.Click += new System.EventHandler(this.btnOK_Click);&lt;br /&gt;
      // &lt;br /&gt;
      // txtAge&lt;br /&gt;
      // &lt;br /&gt;
      this.txtAge.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) &lt;br /&gt;
        | System.Windows.Forms.AnchorStyles.Left) &lt;br /&gt;
        | System.Windows.Forms.AnchorStyles.Right);&lt;br /&gt;
      this.txtAge.Location = new System.Drawing.Point(112, 136);&lt;br /&gt;
      this.txtAge.Name = &amp;quot;txtAge&amp;quot;;&lt;br /&gt;
      this.txtAge.Size = new System.Drawing.Size(176, 20);&lt;br /&gt;
      this.txtAge.TabIndex = 8;&lt;br /&gt;
      this.txtAge.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // txtAddress&lt;br /&gt;
      // &lt;br /&gt;
      this.txtAddress.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) &lt;br /&gt;
        | System.Windows.Forms.AnchorStyles.Right);&lt;br /&gt;
      this.txtAddress.Location = new System.Drawing.Point(112, 40);&lt;br /&gt;
      this.txtAddress.Multiline = true;&lt;br /&gt;
      this.txtAddress.Name = &amp;quot;txtAddress&amp;quot;;&lt;br /&gt;
      this.txtAddress.ScrollBars = System.Windows.Forms.ScrollBars.Both;&lt;br /&gt;
      this.txtAddress.Size = new System.Drawing.Size(176, 72);&lt;br /&gt;
      this.txtAddress.TabIndex = 6;&lt;br /&gt;
      this.txtAddress.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // lblAddress&lt;br /&gt;
      // &lt;br /&gt;
      this.lblAddress.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) &lt;br /&gt;
        | System.Windows.Forms.AnchorStyles.Left);&lt;br /&gt;
      this.lblAddress.Location = new System.Drawing.Point(8, 40);&lt;br /&gt;
      this.lblAddress.Name = &amp;quot;lblAddress&amp;quot;;&lt;br /&gt;
      this.lblAddress.Size = new System.Drawing.Size(92, 23);&lt;br /&gt;
      this.lblAddress.TabIndex = 1;&lt;br /&gt;
      this.lblAddress.Text = &amp;quot;Address&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // lblOccupation&lt;br /&gt;
      // &lt;br /&gt;
      this.lblOccupation.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) &lt;br /&gt;
        | System.Windows.Forms.AnchorStyles.Left);&lt;br /&gt;
      this.lblOccupation.Location = new System.Drawing.Point(8, 120);&lt;br /&gt;
      this.lblOccupation.Name = &amp;quot;lblOccupation&amp;quot;;&lt;br /&gt;
      this.lblOccupation.Size = new System.Drawing.Size(92, 23);&lt;br /&gt;
      this.lblOccupation.TabIndex = 2;&lt;br /&gt;
      this.lblOccupation.Text = &amp;quot;Occupation&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // txtOccupation&lt;br /&gt;
      // &lt;br /&gt;
      this.txtOccupation.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) &lt;br /&gt;
        | System.Windows.Forms.AnchorStyles.Left) &lt;br /&gt;
        | System.Windows.Forms.AnchorStyles.Right);&lt;br /&gt;
      this.txtOccupation.Location = new System.Drawing.Point(112, 112);&lt;br /&gt;
      this.txtOccupation.Name = &amp;quot;txtOccupation&amp;quot;;&lt;br /&gt;
      this.txtOccupation.Size = new System.Drawing.Size(176, 20);&lt;br /&gt;
      this.txtOccupation.TabIndex = 7;&lt;br /&gt;
      this.txtOccupation.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // btnHelp&lt;br /&gt;
      // &lt;br /&gt;
      this.btnHelp.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);&lt;br /&gt;
      this.btnHelp.CausesValidation = false;&lt;br /&gt;
      this.btnHelp.Location = new System.Drawing.Point(296, 48);&lt;br /&gt;
      this.btnHelp.Name = &amp;quot;btnHelp&amp;quot;;&lt;br /&gt;
      this.btnHelp.TabIndex = 11;&lt;br /&gt;
      this.btnHelp.Text = &amp;quot;Help&amp;quot;;&lt;br /&gt;
      this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);&lt;br /&gt;
      // &lt;br /&gt;
      // Form1&lt;br /&gt;
      // &lt;br /&gt;
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);&lt;br /&gt;
      this.ClientSize = new System.Drawing.Size(376, 253);&lt;br /&gt;
      this.Controls.AddRange(new System.Windows.Forms.Control[] {this.btnHelp,&lt;br /&gt;
                                                                       this.btnOK,&lt;br /&gt;
                                                                       this.txtAge,&lt;br /&gt;
                                                                       this.txtOccupation,&lt;br /&gt;
                                     this.txtAddress,&lt;br /&gt;
                                     this.txtName,&lt;br /&gt;
                                     this.lblAge,&lt;br /&gt;
                                     this.lblOccupation,&lt;br /&gt;
                                     this.lblAddress,&lt;br /&gt;
                                     this.lblName});&lt;br /&gt;
      this.MinimumSize = new System.Drawing.Size(384, 280);&lt;br /&gt;
      this.Name = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
      this.Text = &amp;quot;TestBoxTest&amp;quot;;&lt;br /&gt;
      this.ResumeLayout(false);&lt;br /&gt;
    }&lt;br /&gt;
    static void Main() &lt;br /&gt;
    {&lt;br /&gt;
      Application.Run(new Form1());&lt;br /&gt;
    }&lt;br /&gt;
    private void btnOK_Click(object sender, System.EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      string output;&lt;br /&gt;
      output = &amp;quot;Name: &amp;quot; + this.txtName.Text + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
      output += &amp;quot;Address: &amp;quot; + this.txtAddress.Text + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
      output += &amp;quot;Occupation: &amp;quot; + this.txtOccupation.Text + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
      output += &amp;quot;Age: &amp;quot; + this.txtAge.Text;&lt;br /&gt;
      Console.WriteLine(output);&lt;br /&gt;
    }&lt;br /&gt;
    private void btnHelp_Click(object sender, System.EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      string output;&lt;br /&gt;
      output = &amp;quot;Name = Your name&amp;quot; + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
      output += &amp;quot;Address = Your address&amp;quot; + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
      output += &amp;quot;Occupation = Only allowed value is &amp;quot;Employee&amp;quot; or empty&amp;quot; + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
      output += &amp;quot;Age = Your age&amp;quot;;&lt;br /&gt;
      Console.WriteLine(output);&lt;br /&gt;
    }&lt;br /&gt;
    private void txtBoxEmpty_Validating(object sender, System.ruponentModel.CancelEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      TextBox tb;&lt;br /&gt;
      tb = (TextBox)sender;&lt;br /&gt;
      if (tb.Text.Length == 0)&lt;br /&gt;
      {&lt;br /&gt;
        tb.BackColor = Color.Red;&lt;br /&gt;
        tb.Tag = false;&lt;br /&gt;
      }&lt;br /&gt;
      else&lt;br /&gt;
      {&lt;br /&gt;
        tb.BackColor = System.Drawing.SystemColors.Window;&lt;br /&gt;
        tb.Tag = true;&lt;br /&gt;
      }&lt;br /&gt;
      ValidateAll();&lt;br /&gt;
    }&lt;br /&gt;
    private void ValidateAll()&lt;br /&gt;
    {&lt;br /&gt;
      this.btnOK.Enabled = ((bool)(this.txtAddress.Tag) &amp;amp;&amp;amp;&lt;br /&gt;
        (bool)(this.txtAge.Tag) &amp;amp;&amp;amp;&lt;br /&gt;
        (bool)(this.txtName.Tag) &amp;amp;&amp;amp;&lt;br /&gt;
        (bool)(this.txtOccupation.Tag));&lt;br /&gt;
    }&lt;br /&gt;
    private void txtOccupation_Validating(object sender, System.ruponentModel.CancelEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      TextBox tb = (TextBox)sender;&lt;br /&gt;
      if (tb.Text.rupareTo(&amp;quot;Employee&amp;quot;) == 0 || tb.Text.Length == 0)&lt;br /&gt;
      {&lt;br /&gt;
        tb.Tag = true;&lt;br /&gt;
        tb.BackColor = System.Drawing.SystemColors.Window;&lt;br /&gt;
      }&lt;br /&gt;
      else&lt;br /&gt;
      {&lt;br /&gt;
        tb.Tag = false;&lt;br /&gt;
        tb.BackColor = Color.Red;&lt;br /&gt;
      }&lt;br /&gt;
      ValidateAll();&lt;br /&gt;
    }&lt;br /&gt;
    private void txtAge_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      if ((e.KeyChar &amp;lt; 48 || e.KeyChar &amp;gt; 57) &amp;amp;&amp;amp; e.KeyChar != 8)&lt;br /&gt;
        e.Handled = true; // Remove the character&lt;br /&gt;
    }&lt;br /&gt;
    private void txtBox_TextChanged(object sender, System.EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      TextBox tb = (TextBox)sender;&lt;br /&gt;
      if (tb.Text.Length == 0 &amp;amp;&amp;amp; tb != txtOccupation)&lt;br /&gt;
      {&lt;br /&gt;
        tb.Tag = false;&lt;br /&gt;
        tb.BackColor = Color.Red;&lt;br /&gt;
      }&lt;br /&gt;
      else if (tb == txtOccupation &amp;amp;&amp;amp; (tb.Text.Length != 0 &amp;amp;&amp;amp; tb.Text.rupareTo(&amp;quot;Employee&amp;quot;) != 0))&lt;br /&gt;
      {&lt;br /&gt;
        tb.Tag = false;&lt;br /&gt;
      }&lt;br /&gt;
      else&lt;br /&gt;
      {&lt;br /&gt;
        tb.Tag = true;&lt;br /&gt;
        tb.BackColor = SystemColors.Window;&lt;br /&gt;
      }&lt;br /&gt;
      ValidateAll();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>