<?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%2FData_Validation</id>
		<title>Csharp/C Sharp/GUI Windows Form/Data 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%2FData_Validation"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Data_Validation&amp;action=history"/>
		<updated>2026-04-29T15:17:08Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Data_Validation&amp;diff=94&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/Data_Validation&amp;diff=94&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/Data_Validation&amp;diff=95&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/Data_Validation&amp;diff=95&amp;oldid=prev"/>
				<updated>2010-05-26T11:33:05Z</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 Validation==&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;
/*&lt;br /&gt;
User Interfaces in C#: Windows Forms and Custom Controls&lt;br /&gt;
by Matthew MacDonald&lt;br /&gt;
Publisher: Apress&lt;br /&gt;
ISBN: 1590590457&lt;br /&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;
namespace Validation&lt;br /&gt;
{&lt;br /&gt;
    /// &amp;lt;summary&amp;gt;&lt;br /&gt;
    /// Summary description for ErrorProviderValidation.&lt;br /&gt;
    /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    public class ErrorProviderValidation : System.Windows.Forms.Form&lt;br /&gt;
    {&lt;br /&gt;
        internal System.Windows.Forms.Label Label3;&lt;br /&gt;
        internal System.Windows.Forms.TextBox txtEmail;&lt;br /&gt;
        internal System.Windows.Forms.Label Label2;&lt;br /&gt;
        internal System.Windows.Forms.Label Label1;&lt;br /&gt;
        internal System.Windows.Forms.TextBox txtFirstName;&lt;br /&gt;
        internal System.Windows.Forms.TextBox txtLastName;&lt;br /&gt;
        internal System.Windows.Forms.Button Button1;&lt;br /&gt;
        internal System.Windows.Forms.ErrorProvider errProvider;&lt;br /&gt;
        internal System.Windows.Forms.GroupBox grpValidation;&lt;br /&gt;
        /// &amp;lt;summary&amp;gt;&lt;br /&gt;
        /// Required designer variable.&lt;br /&gt;
        /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
        private System.ruponentModel.Container components = null;&lt;br /&gt;
        public ErrorProviderValidation()&lt;br /&gt;
        {&lt;br /&gt;
            //&lt;br /&gt;
            // Required for Windows Form Designer support&lt;br /&gt;
            //&lt;br /&gt;
            InitializeComponent();&lt;br /&gt;
            //&lt;br /&gt;
            // TODO: Add any constructor code after InitializeComponent call&lt;br /&gt;
            //&lt;br /&gt;
        }&lt;br /&gt;
        /// &amp;lt;summary&amp;gt;&lt;br /&gt;
        /// Clean up any resources being used.&lt;br /&gt;
        /// &amp;lt;/summary&amp;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;
        #region Windows Form Designer generated code&lt;br /&gt;
        /// &amp;lt;summary&amp;gt;&lt;br /&gt;
        /// Required method for Designer support - do not modify&lt;br /&gt;
        /// the contents of this method with the code editor.&lt;br /&gt;
        /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
        private void InitializeComponent()&lt;br /&gt;
        {&lt;br /&gt;
            this.grpValidation = new System.Windows.Forms.GroupBox();&lt;br /&gt;
            this.Label3 = new System.Windows.Forms.Label();&lt;br /&gt;
            this.txtEmail = new System.Windows.Forms.TextBox();&lt;br /&gt;
            this.Label2 = new System.Windows.Forms.Label();&lt;br /&gt;
            this.Label1 = new System.Windows.Forms.Label();&lt;br /&gt;
            this.txtFirstName = new System.Windows.Forms.TextBox();&lt;br /&gt;
            this.txtLastName = new System.Windows.Forms.TextBox();&lt;br /&gt;
            this.Button1 = new System.Windows.Forms.Button();&lt;br /&gt;
            this.errProvider = new System.Windows.Forms.ErrorProvider();&lt;br /&gt;
            this.grpValidation.SuspendLayout();&lt;br /&gt;
            this.SuspendLayout();&lt;br /&gt;
            // &lt;br /&gt;
            // grpValidation&lt;br /&gt;
            // &lt;br /&gt;
            this.grpValidation.Controls.AddRange(new System.Windows.Forms.Control[] {&lt;br /&gt;
                                                                                        this.Label3,&lt;br /&gt;
                                                                                        this.txtEmail,&lt;br /&gt;
                                                                                        this.Label2,&lt;br /&gt;
                                                                                        this.Label1,&lt;br /&gt;
                                                                                        this.txtFirstName,&lt;br /&gt;
                                                                                        this.txtLastName});&lt;br /&gt;
            this.grpValidation.Location = new System.Drawing.Point(8, 8);&lt;br /&gt;
            this.grpValidation.Name = &amp;quot;grpValidation&amp;quot;;&lt;br /&gt;
            this.grpValidation.Size = new System.Drawing.Size(368, 124);&lt;br /&gt;
            this.grpValidation.TabIndex = 13;&lt;br /&gt;
            this.grpValidation.TabStop = false;&lt;br /&gt;
            // &lt;br /&gt;
            // Label3&lt;br /&gt;
            // &lt;br /&gt;
            this.Label3.Location = new System.Drawing.Point(16, 88);&lt;br /&gt;
            this.Label3.Name = &amp;quot;Label3&amp;quot;;&lt;br /&gt;
            this.Label3.Size = new System.Drawing.Size(64, 16);&lt;br /&gt;
            this.Label3.TabIndex = 10;&lt;br /&gt;
            this.Label3.Text = &amp;quot;Email:&amp;quot;;&lt;br /&gt;
            // &lt;br /&gt;
            // txtEmail&lt;br /&gt;
            // &lt;br /&gt;
            this.txtEmail.Location = new System.Drawing.Point(84, 84);&lt;br /&gt;
            this.txtEmail.Name = &amp;quot;txtEmail&amp;quot;;&lt;br /&gt;
            this.txtEmail.Size = new System.Drawing.Size(152, 21);&lt;br /&gt;
            this.txtEmail.TabIndex = 9;&lt;br /&gt;
            this.txtEmail.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
            this.txtEmail.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtEmail_KeyPress);&lt;br /&gt;
            // &lt;br /&gt;
            // Label2&lt;br /&gt;
            // &lt;br /&gt;
            this.Label2.Location = new System.Drawing.Point(16, 52);&lt;br /&gt;
            this.Label2.Name = &amp;quot;Label2&amp;quot;;&lt;br /&gt;
            this.Label2.Size = new System.Drawing.Size(64, 16);&lt;br /&gt;
            this.Label2.TabIndex = 8;&lt;br /&gt;
            this.Label2.Text = &amp;quot;Last Name:&amp;quot;;&lt;br /&gt;
            // &lt;br /&gt;
            // Label1&lt;br /&gt;
            // &lt;br /&gt;
            this.Label1.Location = new System.Drawing.Point(16, 28);&lt;br /&gt;
            this.Label1.Name = &amp;quot;Label1&amp;quot;;&lt;br /&gt;
            this.Label1.Size = new System.Drawing.Size(64, 16);&lt;br /&gt;
            this.Label1.TabIndex = 7;&lt;br /&gt;
            this.Label1.Text = &amp;quot;First Name:&amp;quot;;&lt;br /&gt;
            // &lt;br /&gt;
            // txtFirstName&lt;br /&gt;
            // &lt;br /&gt;
            this.txtFirstName.Location = new System.Drawing.Point(84, 24);&lt;br /&gt;
            this.txtFirstName.Name = &amp;quot;txtFirstName&amp;quot;;&lt;br /&gt;
            this.txtFirstName.Size = new System.Drawing.Size(152, 21);&lt;br /&gt;
            this.txtFirstName.TabIndex = 4;&lt;br /&gt;
            this.txtFirstName.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
            this.txtFirstName.Validating += new System.ruponentModel.CancelEventHandler(this.txtName_Validating);&lt;br /&gt;
            // &lt;br /&gt;
            // txtLastName&lt;br /&gt;
            // &lt;br /&gt;
            this.txtLastName.Location = new System.Drawing.Point(84, 48);&lt;br /&gt;
            this.txtLastName.Name = &amp;quot;txtLastName&amp;quot;;&lt;br /&gt;
            this.txtLastName.Size = new System.Drawing.Size(152, 21);&lt;br /&gt;
            this.txtLastName.TabIndex = 5;&lt;br /&gt;
            this.txtLastName.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
            this.txtLastName.Validating += new System.ruponentModel.CancelEventHandler(this.txtName_Validating);&lt;br /&gt;
            // &lt;br /&gt;
            // Button1&lt;br /&gt;
            // &lt;br /&gt;
            this.Button1.Location = new System.Drawing.Point(152, 204);&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;
            // &lt;br /&gt;
            // errProvider&lt;br /&gt;
            // &lt;br /&gt;
            this.errProvider.DataMember = null;&lt;br /&gt;
            // &lt;br /&gt;
            // ErrorProviderValidation&lt;br /&gt;
            // &lt;br /&gt;
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);&lt;br /&gt;
            this.ClientSize = new System.Drawing.Size(388, 242);&lt;br /&gt;
            this.Controls.AddRange(new System.Windows.Forms.Control[] {&lt;br /&gt;
                                                                          this.grpValidation,&lt;br /&gt;
                                                                          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, ((System.Byte)(0)));&lt;br /&gt;
            this.Name = &amp;quot;ErrorProviderValidation&amp;quot;;&lt;br /&gt;
            this.Text = &amp;quot;ErrorProviderValidation&amp;quot;;&lt;br /&gt;
            this.grpValidation.ResumeLayout(false);&lt;br /&gt;
            this.ResumeLayout(false);&lt;br /&gt;
        }&lt;br /&gt;
        #endregion&lt;br /&gt;
        [STAThread]&lt;br /&gt;
        static void Main() &lt;br /&gt;
        {&lt;br /&gt;
            Application.Run(new ErrorProviderValidation());&lt;br /&gt;
        }&lt;br /&gt;
        private void Button1_Click(object sender, System.EventArgs e)&lt;br /&gt;
        {&lt;br /&gt;
            bool invalidInput = false;&lt;br /&gt;
            &lt;br /&gt;
            foreach (Control ctrl in this.grpValidation.Controls)&lt;br /&gt;
            {&lt;br /&gt;
                if (errProvider.GetError(ctrl) != &amp;quot;&amp;quot;)&lt;br /&gt;
                {&lt;br /&gt;
                    invalidInput = true;&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            if (invalidInput)&lt;br /&gt;
            {&lt;br /&gt;
                MessageBox.Show(&amp;quot;You still have invalid input.&amp;quot;, &amp;quot;Invalid Input&amp;quot;, MessageBoxButtons.OK, MessageBoxIcon.Warning);&lt;br /&gt;
            }&lt;br /&gt;
            else&lt;br /&gt;
            {&lt;br /&gt;
                this.Close();&lt;br /&gt;
            }&lt;br /&gt;
        &lt;br /&gt;
        }&lt;br /&gt;
        private void txtName_Validating(object sender, System.ruponentModel.CancelEventArgs e)&lt;br /&gt;
        {&lt;br /&gt;
            Control ctrl = (Control)sender;&lt;br /&gt;
            if (ctrl.Text == &amp;quot;&amp;quot;)&lt;br /&gt;
            {&lt;br /&gt;
                errProvider.SetError(ctrl, &amp;quot;You must enter a first and last name.&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
            else&lt;br /&gt;
            {&lt;br /&gt;
                errProvider.SetError(ctrl, &amp;quot;&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        private void txtEmail_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)&lt;br /&gt;
        {&lt;br /&gt;
            System.Text.RegularExpressions.Regex regex;&lt;br /&gt;
            regex = new System.Text.RegularExpressions.Regex(@&amp;quot;\S+@\S+\.\S+&amp;quot;);&lt;br /&gt;
            Control ctrl = (Control)sender;&lt;br /&gt;
            if (regex.IsMatch(ctrl.Text))&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;Not a valid email.&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    &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;
==Simple Form Validation==&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;
/*&lt;br /&gt;
User Interfaces in C#: Windows Forms and Custom Controls&lt;br /&gt;
by Matthew MacDonald&lt;br /&gt;
Publisher: Apress&lt;br /&gt;
ISBN: 1590590457&lt;br /&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;
namespace Validation&lt;br /&gt;
{&lt;br /&gt;
    /// &amp;lt;summary&amp;gt;&lt;br /&gt;
    /// Summary description for SimpleValidation.&lt;br /&gt;
    /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    public class SimpleValidation : System.Windows.Forms.Form&lt;br /&gt;
    {&lt;br /&gt;
        internal System.Windows.Forms.GroupBox GroupBox1;&lt;br /&gt;
        internal System.Windows.Forms.Label Label2;&lt;br /&gt;
        internal System.Windows.Forms.Label Label1;&lt;br /&gt;
        internal System.Windows.Forms.TextBox txtFirstName;&lt;br /&gt;
        internal System.Windows.Forms.TextBox txtLastName;&lt;br /&gt;
        internal System.Windows.Forms.Button Button1;&lt;br /&gt;
        /// &amp;lt;summary&amp;gt;&lt;br /&gt;
        /// Required designer variable.&lt;br /&gt;
        /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
        private System.ruponentModel.Container components = null;&lt;br /&gt;
        public SimpleValidation()&lt;br /&gt;
        {&lt;br /&gt;
            //&lt;br /&gt;
            // Required for Windows Form Designer support&lt;br /&gt;
            //&lt;br /&gt;
            InitializeComponent();&lt;br /&gt;
            //&lt;br /&gt;
            // TODO: Add any constructor code after InitializeComponent call&lt;br /&gt;
            //&lt;br /&gt;
        }&lt;br /&gt;
        /// &amp;lt;summary&amp;gt;&lt;br /&gt;
        /// Clean up any resources being used.&lt;br /&gt;
        /// &amp;lt;/summary&amp;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;
        #region Windows Form Designer generated code&lt;br /&gt;
        /// &amp;lt;summary&amp;gt;&lt;br /&gt;
        /// Required method for Designer support - do not modify&lt;br /&gt;
        /// the contents of this method with the code editor.&lt;br /&gt;
        /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
        private void InitializeComponent()&lt;br /&gt;
        {&lt;br /&gt;
            this.GroupBox1 = new System.Windows.Forms.GroupBox();&lt;br /&gt;
            this.Label2 = new System.Windows.Forms.Label();&lt;br /&gt;
            this.Label1 = new System.Windows.Forms.Label();&lt;br /&gt;
            this.txtFirstName = new System.Windows.Forms.TextBox();&lt;br /&gt;
            this.txtLastName = new System.Windows.Forms.TextBox();&lt;br /&gt;
            this.Button1 = new System.Windows.Forms.Button();&lt;br /&gt;
            this.GroupBox1.SuspendLayout();&lt;br /&gt;
            this.SuspendLayout();&lt;br /&gt;
            // &lt;br /&gt;
            // GroupBox1&lt;br /&gt;
            // &lt;br /&gt;
            this.GroupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {&lt;br /&gt;
                                                                                    this.Label2,&lt;br /&gt;
                                                                                    this.Label1,&lt;br /&gt;
                                                                                    this.txtFirstName,&lt;br /&gt;
                                                                                    this.txtLastName});&lt;br /&gt;
            this.GroupBox1.Location = new System.Drawing.Point(8, 12);&lt;br /&gt;
            this.GroupBox1.Name = &amp;quot;GroupBox1&amp;quot;;&lt;br /&gt;
            this.GroupBox1.Size = new System.Drawing.Size(368, 88);&lt;br /&gt;
            this.GroupBox1.TabIndex = 11;&lt;br /&gt;
            this.GroupBox1.TabStop = false;&lt;br /&gt;
            // &lt;br /&gt;
            // Label2&lt;br /&gt;
            // &lt;br /&gt;
            this.Label2.Location = new System.Drawing.Point(16, 52);&lt;br /&gt;
            this.Label2.Name = &amp;quot;Label2&amp;quot;;&lt;br /&gt;
            this.Label2.Size = new System.Drawing.Size(64, 16);&lt;br /&gt;
            this.Label2.TabIndex = 8;&lt;br /&gt;
            this.Label2.Text = &amp;quot;Last Name:&amp;quot;;&lt;br /&gt;
            // &lt;br /&gt;
            // Label1&lt;br /&gt;
            // &lt;br /&gt;
            this.Label1.Location = new System.Drawing.Point(16, 28);&lt;br /&gt;
            this.Label1.Name = &amp;quot;Label1&amp;quot;;&lt;br /&gt;
            this.Label1.Size = new System.Drawing.Size(64, 16);&lt;br /&gt;
            this.Label1.TabIndex = 7;&lt;br /&gt;
            this.Label1.Text = &amp;quot;First Name:&amp;quot;;&lt;br /&gt;
            // &lt;br /&gt;
            // txtFirstName&lt;br /&gt;
            // &lt;br /&gt;
            this.txtFirstName.Location = new System.Drawing.Point(84, 24);&lt;br /&gt;
            this.txtFirstName.Name = &amp;quot;txtFirstName&amp;quot;;&lt;br /&gt;
            this.txtFirstName.Size = new System.Drawing.Size(152, 21);&lt;br /&gt;
            this.txtFirstName.TabIndex = 4;&lt;br /&gt;
            this.txtFirstName.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
            this.txtFirstName.Validating += new System.ruponentModel.CancelEventHandler(this.txtName_Validating);&lt;br /&gt;
            // &lt;br /&gt;
            // txtLastName&lt;br /&gt;
            // &lt;br /&gt;
            this.txtLastName.Location = new System.Drawing.Point(84, 48);&lt;br /&gt;
            this.txtLastName.Name = &amp;quot;txtLastName&amp;quot;;&lt;br /&gt;
            this.txtLastName.Size = new System.Drawing.Size(152, 21);&lt;br /&gt;
            this.txtLastName.TabIndex = 5;&lt;br /&gt;
            this.txtLastName.Text = &amp;quot;&amp;quot;;&lt;br /&gt;
            this.txtLastName.Validating += new System.ruponentModel.CancelEventHandler(this.txtName_Validating);&lt;br /&gt;
            // &lt;br /&gt;
            // Button1&lt;br /&gt;
            // &lt;br /&gt;
            this.Button1.Location = new System.Drawing.Point(152, 208);&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 = 10;&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;
            // &lt;br /&gt;
            // SimpleValidation&lt;br /&gt;
            // &lt;br /&gt;
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);&lt;br /&gt;
            this.ClientSize = new System.Drawing.Size(384, 242);&lt;br /&gt;
            this.Controls.AddRange(new System.Windows.Forms.Control[] {&lt;br /&gt;
                                                                          this.GroupBox1,&lt;br /&gt;
                                                                          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, ((System.Byte)(0)));&lt;br /&gt;
            this.Name = &amp;quot;SimpleValidation&amp;quot;;&lt;br /&gt;
            this.Text = &amp;quot;SimpleValidation&amp;quot;;&lt;br /&gt;
            this.GroupBox1.ResumeLayout(false);&lt;br /&gt;
            this.ResumeLayout(false);&lt;br /&gt;
        }&lt;br /&gt;
        #endregion&lt;br /&gt;
        private void Button1_Click(object sender, System.EventArgs e)&lt;br /&gt;
        {&lt;br /&gt;
            this.Close();&lt;br /&gt;
        }&lt;br /&gt;
        [STAThread]&lt;br /&gt;
        static void Main() &lt;br /&gt;
        {&lt;br /&gt;
            Application.Run(new SimpleValidation());&lt;br /&gt;
        }&lt;br /&gt;
        private void txtName_Validating(object sender, System.ruponentModel.CancelEventArgs e)&lt;br /&gt;
        {&lt;br /&gt;
            if (((TextBox)sender).Text == &amp;quot;&amp;quot;)&lt;br /&gt;
            {&lt;br /&gt;
                MessageBox.Show(&amp;quot;You must enter a first and last name.&amp;quot;, &amp;quot;Invalid Input&amp;quot;, MessageBoxButtons.OK, MessageBoxIcon.Warning);&lt;br /&gt;
                e.Cancel = true;&lt;br /&gt;
            }&lt;br /&gt;
        }&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>