vs2005控件验证方法

errorProvider   组件   

if (this.textBox1.Text.Length == 0)
            {
                errMain.SetIconAlignment((Control)sender, ErrorIconAlignment.MiddleRight);
                errMain.SetError((Control)sender, "can't be null");
                e.Cancel = true;               
            }
            else
            {
                errMain.SetError((Control)sender, "");
            } 

helpprovider组件

   private void Form1_Load(object sender, EventArgs e)
        {
            helpProvider1.SetHelpString(this.textBox1, "只要输入一个东西就可以了");
            helpProvider1.SetHelpString(this.textBox2, "只要输入一个东西就可以了");
        }

 

你可能感兴趣的:(object,null)