Thread: text limit in text box

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    223

    text limit in text box

    Hi, does anyone know what is the maximum amount of text that a text box will accept?
    I am using Microsoft VC++ 6 and MFC.
    zMan

  2. #2

  3. #3
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Wouldn't it probably be a power of 2 like 32 768?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  4. #4
    Registered User johnnie2's Avatar
    Join Date
    Aug 2001
    Posts
    186
    The upper limit is determined by the operating system, and is indeed a power of two. If the application does not manually set the upper limit, the edit control is constrained to 32,767 bytes by default. On NT-based systems, the absolute maximum is theoretically 2 GB; on other Windows systems, the maximum is again 32,767 bytes.
    "Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C

  5. #5
    jasondoucette.com JasonD's Avatar
    Join Date
    Mar 2003
    Posts
    278
    Originally posted by XSquared
    Wouldn't it probably be a power of 2 like 32 768?
    I would have assumed so, but I read that it was 30,000 exactly. I assumed this was an error, so I tried it out myself on my WinXP system, and pasted text in there until it could take no more. I selected all the text and pasted it into notepad, and saved the file. It was exactly 30,000 bytes. I have just confirmed this, as well on a Win98 system... 30,000 bytes, again. This is a standard edit control with no code to change the upper limit.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Obtaining a value from a text box
    By thetinman in forum Windows Programming
    Replies: 1
    Last Post: 11-23-2006, 05:50 PM
  2. find if text in edit box has been changed
    By willc0de4food in forum Windows Programming
    Replies: 13
    Last Post: 09-10-2005, 10:47 PM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM