Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2006

Tip: Looking for answers? Try searching our database.

Problem displaying 40,000 - 60 char entries in a text box.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ty - 14 Mar 2006 23:51 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.