Assuming Windows Forms:
TextBox.MaxLength
This property can be used to limit the length of text entered into the control for values ββsuch as postal codes and phone numbers. You can also use this property to limit the length of the entered text when data should be stored in the database so that the text entered in the control does not exceed the maximum length of the corresponding field in the database.
This property does not affect characters that are added programmatically.
0, , , .
( , . , . TextBox / .)