The int.MaxValue limit int.MaxValue in any case unattainable. You cannot create a string for almost such a long time. In other words, if you really need more than 2 31 you have more problems than TextBox.MaxLength .
May I ask when you think it will actually be a rewarding experience to have more than 2 GB of ASCII text file in one GUI control? If you want to write a complete text editor that can handle huge files, you probably don't want to use a TextBox to get started ...
EDIT: I would actually argue that you probably want to set a limit less than int.MaxValue determined through testing - it is likely that the other bits of your system will fail before you approach that limit. Think about what the real limit is if you want, but I guarantee that it will be below int.MaxValue ...
source share