a)         纯数字 – [0-9]*b)        纯字母 – [a-zA-Z]*

解决方案 »

  1.   

    在ToolBox工具条中找到并拖出RegularExpressionValidator控件到你的TextBox所在的文件...
    然后选中它,设置ValidationExpression属性中写入  \d+
    然后设置ControlToValidate属性中选择要验证的TextBox的ID
    就ok啦
      

  2.   

    (VB.Net 部分)
                   Private istg_char() As Char = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}   ' 定義一個數組
                   
                  Dim istg_check_char as string
                   istg_check_char=Text1.Text.Trim(Me.istg_char)
                   If istg_check_char="" then
                        Messagebox.show("為數字型")
                   else
                        Messagebox.show("為字符串")
                    End If    (C# 部分)
                    char[] number=new char(10){'0','1','2','3','4','5','6','7','8','9'};
                       
                    strng check=textbox1.text.trim(number);
                    if(check= ="")
                        {
                            MessageBox.Show("為數字型");
                        }
                       Else
                        {
                        Messagebox.show("為字符串");
                        }    
      

  3.   

    http://blog.csdn.net/zwxrain/archive/2004/12/22/225408.aspx