multi-line text box

C

cj

I use multi-line text boxes with vertical scroll bars in several of my
programs to display log information as the programs run. Once the text
more than fills the visible portion of the textbox I would like the text
box to show the bottom of the text in it. Right now even if I scroll
down in the text box to see what's the latest activity when new text is
added the textbox resets itself to show only the top text and I have to
scroll down again. Can I fix it so as text is added it continues to
display the last, bottom most, text?
 
O

\(O\)enone

cj said:
Can I fix it so as text is added it
continues to display the last, bottom most, text?

After you add each line of text, try executing the following code:

\\\
TextBox1.SelectionStart = TextBox2.Text.Length
TextBox1.ScrollToCaret()
///

That will set the cursor to be at the very end of the text and then scroll
the textbox so that that point is visible.

HTH,
 
S

Stephany Young

Another point.

You must be mindful of how much text you are appending over the course of a
program run.

If you keep appending text ad infintum then sooner or later it will blow up
because the resource limit will be reached. There is no specific number for
this.

If there is a danger of this then you need to have a method for cleaning
some of the older stuff out to make way for the new stuff.
 
C

cj

No danger of that.

Stephany said:
Another point.

You must be mindful of how much text you are appending over the course
of a program run.

If you keep appending text ad infintum then sooner or later it will blow
up because the resource limit will be reached. There is no specific
number for this.

If there is a danger of this then you need to have a method for cleaning
some of the older stuff out to make way for the new stuff.
 
C

Cor Ligthert [MVP]

CJ,

Be aware that there was a bug in the multiline textbox and that the ammount
of data that a textbox can hold (was)is very limmited. I don't know if that
bug is fixed.

Cor
 

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