I have a problem that should be relatively easy to fix but the solution just
seems to elude me.
I am creating a Windows app that contains a text box that I wish to fill
with data from a file. The file contains approximately 40k, 60 character
entries and it is taking an enormous amount of time to load the file contents
into the text box. Is there some way to speed this up?
I am currently reading an entry from the file and using the code:
FileNameTextBox.Text += sFileEntry;
to display the entry.
Thanks,
Ty
Jeff - 15 Mar 2006 00:06 GMT
> I have a problem that should be relatively easy to fix but the solution just
> seems to elude me.
[quoted text clipped - 10 lines]
> Thanks,
> Ty
I faced a similar problem a while ago and did this:
StringBuilder sb = new StringBuilder();
// Append the 40,000 entries to sb
FileNameTextBox.Text += sb.ToString();
Worked great for me!
I hope this helps.
-Jeff
James Curran - 15 Mar 2006 05:09 GMT
> StringBuilder sb = new StringBuilder();
> // Append the 40,000 entries to sb
> FileNameTextBox.Text += sb.ToString();
That really should be:
SringBuilder sb = new StringBuilder(2400000);
// Append the 40,000 entries to sb
FileNameTextBox.Text += sb.ToString();

Signature
Truth,
James Curran [erstwhile-MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
James Curran - 15 Mar 2006 05:10 GMT
> I am creating a Windows app that contains a text box that I wish to
> fill with data from a file. The file contains approximately 40k, 60
> character entries and it is taking an enormous amount of time to load
> the file contents into the text box. Is there some way to speed this
> up?
Well, I'm not sure if it well be any faster, but I'll bet this will be
more useable:
put them in a listbox.

Signature
Truth,
James Curran [erstwhile-MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
Michael Nemtsev - 15 Mar 2006 06:00 GMT
Hello Ty,
Are u really need all data being showed on the screen? Seems no. Just fill
that box async in the form start, thus fillin' of the box will be performed
in the background
T> I have a problem that should be relatively easy to fix but the
T> solution just seems to elude me.
T>
T> I am creating a Windows app that contains a text box that I wish to
T> fill with data from a file. The file contains approximately 40k, 60
T> character entries and it is taking an enormous amount of time to load
T> the file contents into the text box. Is there some way to speed this
T> up?
T>
T> I am currently reading an entry from the file and using the code:
T> FileNameTextBox.Text += sFileEntry;
T> to display the entry.
T> Thanks,
T> Ty
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche