locked
Validation in VB.NET RRS feed

  • Question

  • User-1578974752 posted

    How to put validation such that number Of characters in the textbox exceeds 200 , must show msg in label that exceeded. Thanks

    Monday, October 8, 2018 5:48 AM

Answers

  • User1724605321 posted

    Hi shsu ,

    You can try :

     <asp:RegularExpressionValidator ID="regularExpressionValidator1"
     ControlToValidate="YourTextBoxID" runat="server" 
     ValidationExpression="^[\s\S]{0,200}$" Text="200 characters max" />

    Or directly force max length of a text box field :

    <asp:TextBox MaxLength="200" id="textbox1" runat=server> </asp:TextBox> 

    Best Regards,

    Nan Yu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 8, 2018 6:26 AM