Solved

Managing large text boxes

Posted on 1998-10-14
2
133 Views
Last Modified: 2010-08-05
Hello! I have found while populating a text box with code similar to :

  Dim filename As String
  filename = "c:\large.txt"
  Open filename For Input As #1
  Dim x As Variant
  Do While Not EOF(1)
    Line Input #1, x
    textbox.Text = textbox.Text + x + vbCrLf
  Loop
Close #1

that handling 1000+ lines causes the program to lock up (predicatably) Does anyone has a nice bit of code which allows a routine to read in say 100 lines then detects manages the population of the rest of the file buy scroll or page up/down etc actions?  

Cheers

Stewart Wood
0
Comment
Question by:StewartWood
2 Comments
 
LVL 6

Accepted Solution

by:
anthonyc earned 100 total points
ID: 1439848
A text box can only hold 32K of text (64K of storage, but in unicode, 1 character is 2 bytes).  You are probably locking up when you hit that bound.

Use a rich text box, and you can do what you want without problems.
0
 

Author Comment

by:StewartWood
ID: 1439849
So simple, so effective. I forgot about the RTB

Thanks mate : )
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now