Text boxes and string length

L

Lilith

I'm looking at practical string lengths and the capacity of a text
box. I'm using a string to progressively add the status of a process
periodically and dumping that text into a text box. I don't mind
trimming the first x number of lines from the string when it reaches
certain limits, but I'd like to know at what point I may be
approaching an exception being thrown, an application crash or system
memory getting consumed.

If possible, I'd also like some suggestions as to the best way to trim
the first few lines of the string, which will be delimited by \r\n.

Thanks,
Lilith
 
L

Laura T.

As of Win32, the normal edit box controls do not have hard limits (to be
precise, they have 2GB-1 limit...,
http://msdn2.microsoft.com/en-us/library/ms672096.aspx) the
practical(technical) limit comes, IMHO, from the available memory ad
required performance. The .NET does not seem to expose any further
limitations so it's only a memory/performance problem.
Preallocating memory may be a good thing.

From the user point of view, the ability to see 4 days old things might not
be interesting so another practical limit can come from there.

The use of indexOf()/lastIndexOf() and substring is the best I can think of
for now.
If you have some fixed lengths, you can play with count parameter of
indexOf..
 
L

Lilith

The time involved was another concern. A day's worth of report is
sufficient in most circumstance. But since this involves unmanned
monitoring, a weekend plus a day worth of data might be necessary for
the Monday morning visual check.

Eventually I'll add some logging capability, but for now I just need
to advance the application to a usable stage.

Many thanks,
Lilith
 
P

Peter Duniho

Lilith said:
The time involved was another concern. A day's worth of report is
sufficient in most circumstance. But since this involves unmanned
monitoring, a weekend plus a day worth of data might be necessary for
the Monday morning visual check.

Eventually I'll add some logging capability, but for now I just need
to advance the application to a usable stage.

For what it's worth, you are likely to run into usability issues LONG
before you run into any technical problems. The TextBox control can
contain WAY more text than a user can in any sort of practical way deal
with. This is true both from a performance point of view (initializing
and interacting with the control) as well as from the user's ability to
navigate the data.

I suspect you will find it necessary to provide a UI that allows the
user to interact with the data in more manageable pieces long before you
run out of system resources required to display the data.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top