The text text box in the WinForm form only allows the data letters to control how regular expression

Updated on technology 2024-02-09
22 answers
  1. Anonymous users2024-02-05

    Register the keypress event for this textbox.

    new ;

    Then implement the method.

    private void txtuserid_keypress(object sender, keypresseventargs e)

    if (('z' &&'a') |== '\b')= false;

    true;In fact, if you only enter letters, you won't need regular expressions at all. Use the above method to do the trick.

  2. Anonymous users2024-02-04

    Determine the ASCII code of the character you entered in the keypress event of the textbox.

    if(>=97 &&=122 ||=65 &&=90)= false;

    true;

  3. Anonymous users2024-02-03

    Convert the strings in the text to an array of characters, and iterate through the entire array to determine whether it is a letter or not.

  4. Anonymous users2024-02-02

    Let's say the text box is txtuser

    regex re = new regex("^[a-za-z]*$", ;

    string str=;

    if (Correct.) else

    Error, mismatch.

  5. Anonymous users2024-02-01

    The correct way to do this is to add a beginning and end mark.

    string putter = "^[^',;=?$\x22]+$";This means that from the beginning to the end there are 1 n non-special characters.

    **As follows: regex reg = new regex(@"^\d(?:d)?$");

    if (!else

  6. Anonymous users2024-01-31

    [^%',;=?$\x22]+

    This is a match of 1 n %',;=?$\", enter f'At this point, f is passed', because f is the correct character, matching f returns true

    The correct way to do this is to add a beginning and end mark.

    string putter = "^[^',;=?$\x22]+$";This means that from the beginning to the end there are 1 n non-special characters.

  7. Anonymous users2024-01-30

    private void textbox1_keypress(object sender, keypresseventargs e)else

    This is the realization that you can only enter the numbers 0-9, as well as the letters a-z, a-z, if you need to add something else.

  8. Anonymous users2024-01-29

    Then use the regular put.

    C Usage: TextBox Text Box ID: txt Value Chinese Character: U4E00- U9FA5]+$

    using ;Referencing namespaces.

    string reg value= @u4e00- u9fa5]+$ can only be entered in Chinese.

    if (!reg_value))

    If you want to determine if you want to enter something else, you just need to change the regular.

  9. Anonymous users2024-01-28

    If you can enter it, just enter it directly.

  10. Anonymous users2024-01-27

    using ;

    public static bool isemail(string value)

    |(a-z0-9][\w\.-a-z0-9]\.

    a-z][a-z\.]a-z]$");

    You can call this method, I hope it will help you, and if you have any questions, please ask or hi

  11. Anonymous users2024-01-26

    header file using ;

    bool istrue = ,@"p (write your regular expression in quotation marks).");

    if (!istrue)

  12. Anonymous users2024-01-25

    "What to verify","Regular expressions")

  13. Anonymous users2024-01-24

    Add a keypress event to the form's text box (e.g. textbox1 keypress below).

    private void textbox1_keypress(object sender, keypresseventargs e)

    After the test, you can only enter Chinese characters, if you enter something else, there is no response.

    If you still have any questions about the above, you can hi me.

  14. Anonymous users2024-01-23

    var str="***"The text var patt=@ in the text box"^[\u4e00-\u9fa5]+$"This is the pattern to match.

    var r=new regex(patt);

    var pasflag=;true identifies matching the prescribed format, false does not.

  15. Anonymous users2024-01-22

    Add the onblur() event of textbox to the backend pageload, and then write a judgment function in js.

  16. Anonymous users2024-01-21

    If you want to verify whether Chinese is included after input, please use the regular expression on the first floor.

    If you want to prohibit Chinese input methods when typing, please change the imemode property of the control to disabled (or change it in **) in the designer

    Method 2 will cause the focus to be unable to switch through the keyboard shortcut when this control opens other input methods, and the floating box of the input method will also be hidden.

  17. Anonymous users2024-01-20

    Only numbers and English:

  18. Anonymous users2024-01-19

    Convert the input to ASCII code If it is greater than 128, it is a Chinese character, and the regular expression should not be able to judge the Chinese character.

  19. Anonymous users2024-01-18

    Do you want the textbox to not be able to input Chinese characters or numbers? Regular expressions just limit the type of input.

    You can write a method to limit it, it's not very troublesome, look up more libraries, pay more attention to properties and methods, it's good for learning, read more, and have an impression when you use it.

  20. Anonymous users2024-01-17

    In regex, the matching character is: [u4e00- u9fa5].

  21. Anonymous users2024-01-16

    The engineering documents are sent to you, I hope they will be helpful to you.

  22. Anonymous users2024-01-15

    Remove tags with regular expressions.

Related questions
19 answers2024-02-09

Write this when popping up a modal window.

form2frm >>>More

12 answers2024-02-09

option explicit statement.

Used at the module level to force all variables in the module to be explicitly declared. >>>More

10 answers2024-02-09

datatable operation.

The query is placed in dt1 >>>More

19 answers2024-02-09

Write in the click of button1; Then write using system in the main function; >>>More