需要一个验证..一个文本框可以不输入,或者输入单个或者多个邮件.当输入多个邮件的时候用";"隔开.

解决方案 »

  1.   

    split成数组,
    然后循环判断
      

  2.   

    if(this.textbox.Text.Contains(','))
    {
     //输入错误不能包含,
    }
    else if(this.textbox.Text.Contains(';'))
    {
     //多个邮箱地址用string [] arr= split(';')接受再循环遍历
    }
      

  3.   

    http://huanghao5668.blog.163.com/blog/static/20561202200710713630277/
      

  4.   

    我觉得应该用正则Validator。
    不知道正则专家们有没有好办法。
      

  5.   

    看看这里有没有能用的。
    http://regexlib.com/DisplayPatterns.aspx在页面里面搜multiple
      

  6.   

     string pattern = @"(?im)(([a-zA-Z0-9]+[_.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}[;;]?)*";
                string text=this.textBox1.Text.Trim();
                if (Regex.IsMatch(text, pattern))
                {
                    MessageBox.Show("输入正确");
                }
      

  7.   

    public static void GetA3() 
            {
                string str = "[email protected];[email protected]";
                Regex regex = new Regex(@"^(\w[A-Za-z\d]+@[\d\w]+(.[\d\w])+[;;]?)+$");
                Console.WriteLine(regex.IsMatch(str));
            }
      

  8.   

    正則
     (^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*[;])+$||^\S*$(^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*[;])+驗證一條或多條Email
    ^\S*驗證空