Hi peoples,

I have a textbox:

<asp:TextBox 
     ID="TextBoxFirstName" 
     runat="server">
</asp:TextBox>

I need to make sure that it captures data for a first name allowing letters from a-z, A-Z and special characters like - (dash) and the space characters. The validator will block all other characters. How do I go about doing this using VB (if possible).

Cheers

<asp:TextBox ID="txtName" runat="server"/>
    <asp:Button ID="btnSubmit" runat="server" Text="Submit" />
    <asp:RegularExpressionValidator ID="regexpName" runat="server"     
                                    ErrorMessage="This expression does not validate." 
                                    ControlToValidate="txtName"     
                                    ValidationExpression="^[a-zA-Z'(.|_|' ')\s]{1,40}$" />
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.