Just wondering how many char can C# Textbox multiline hold?
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- How do I bind a DataGridViewComboBoxColumn to a pr
- Partial Form Class C# - Only display code view for
- Can we add four protocols to ServicePointManager.S
- How to properly handle form closing when using bac
相关文章
- Sort TreeView Automatically Upon Adding Nodes
- Where does this quality loss on Images come from?
- Is it possible to convert bitset<8> to char in c++
- Missing partial modifier on declaration of type
- PropertyGrid - Possible to have a file/directory s
- Why do base Windows Forms form class with generic
- How to handle the TextChanged event only when the
- Difference between SuspendLayout and BeginUpdate
I don't think there's any fixed limit on the size of text you can put in a Windows.Forms.TextBox (specifying C# is irrelevant). I've thrown several megabytes of character data in there at times, and it's worked in a satisfactory manner.
However, there may be practical limit - the control isn't oriented towards handling large amounts of text, so performance goes down as the volume goes up.
Depending on the hardware of your users, this may or may not be an issue.
If you need to provide good editing of multi-megabyte text areas, using a properly designed editing control would be a good idea.
The other answers seems to assume WinForms development.
If the case that you are doing ASP.NET development, please be aware that the
MaxLength
property of theSystem.Web.UI.WebControls.TextBox
class is ignored whenTextMode = Multiline
. The reason is simple: the<textarea>
HTML element does not provide any way to restrict the length of its contents.You will need to do some client scripting in order to enforce a max length on a textarea.
for Windows NT 4.0, Windows 2000, Windows 2000 Professional, Windows 2000 Server, Windows 2000 Advanced Server, Windows XP Home Edition, Windows XP Professional x64 Edition, Windows Server 2003 Platform :-
for Windows Millennium Edition Platform :
for more information see this link
Look at the
MaxLength
property of theTextBox
- it stores the maximum number of characters the control can take; as per the documentation, it is changeable. Usually the default is big enough, though. (Although I imagine that since you're asing the question, it may not be!)From the docs, you can see that the maximum value for
MaxLength
is 2147483646. This is, of course, limited by the memory of the target machine.