Restriction of length in TextBox



  • I want to limit it. TextBox length of input. Maximum 6.

    1. In Yours MaxLength Yes. 6

    2. In the code. tb_display.MaxLength = 6;but nothing helps.



  • MaskedTextBox can be used for the introduction.

    var f = new Form();
    var t = new MaskedTextBox() { Parent = f, Dock = DockStyle.Fill };
    t.Mask = "AAAAAA";  // не больше 6-ти цифр или букв
    f.ShowDialog();
    

    The meaning of Mask is drawn from masking language -- https://msdn.microsoft.com/en-us/library/ms234064.aspx




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2