Restriction of length in TextBox
-
I want to limit it.
TextBox
length of input. Maximum 6.In Yours
MaxLength
Yes.6
♪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