forcing multiline textbox to scroll to last line... 
Author Message
 forcing multiline textbox to scroll to last line...

here's the problem:
i'm running a command-line executable as a managed
process from code in a utility i'm developing, and i'm
redirecting the standard output from this executable to a
multiline textbox on the form.  since this utility has to
do with file compression, i'm listing all the files added
to the archive and the percent complete in this textbox.  
do to the nature of the utility, it can take some time to
complete this process, and hundreds of lines of output
may be generated.  i'm adding each line of output that is
applicable by altering the .Lines array.  the problem is,
as i add these new lines to the textbox, it doesn't
automatically scroll to the last line, and so the user
isn't able to see the most recent files or percent of
completion until the process has ended.  IS THERE ANY WAY
TO FORCE THE TEXTBOX TO SCROLL TO THE LAST LINE IN THE
LINES ARRAY?  the only method i've found that even
remotely applies is the .ScrollToCaret method, which
won't work unless i can find a way to move the caret to
the last line of the textbox before invoking the
method...i've tried using the SendKeys.Send("{DOWN}")
method, but that won't work either.  i'm kinda stuck
here.  does ANYONE know how to do this??? thanks!


Mon, 27 Jun 2005 01:24:25 GMT  
 forcing multiline textbox to scroll to last line...
This works for me:

TextBox1.SelectionStart = TextBox1.Text.Length
TextBox1.ScrollToCaret()


Quote:
> here's the problem:
> i'm running a command-line executable as a managed
> process from code in a utility i'm developing, and i'm
> redirecting the standard output from this executable to a
> multiline textbox on the form.  since this utility has to
> do with file compression, i'm listing all the files added
> to the archive and the percent complete in this textbox.
> do to the nature of the utility, it can take some time to
> complete this process, and hundreds of lines of output
> may be generated.  i'm adding each line of output that is
> applicable by altering the .Lines array.  the problem is,
> as i add these new lines to the textbox, it doesn't
> automatically scroll to the last line, and so the user
> isn't able to see the most recent files or percent of
> completion until the process has ended.  IS THERE ANY WAY
> TO FORCE THE TEXTBOX TO SCROLL TO THE LAST LINE IN THE
> LINES ARRAY?  the only method i've found that even
> remotely applies is the .ScrollToCaret method, which
> won't work unless i can find a way to move the caret to
> the last line of the textbox before invoking the
> method...i've tried using the SendKeys.Send("{DOWN}")
> method, but that won't work either.  i'm kinda stuck
> here.  does ANYONE know how to do this??? thanks!



Mon, 27 Jun 2005 02:17:27 GMT  
 forcing multiline textbox to scroll to last line...
that would have been the obvious solution, wouldn't
it?!?  i feel like an idiot now!  i guess we all need a
complete stranger to point out the obvious sometimes!

thanks much!
ben

Quote:
>-----Original Message-----
>This works for me:

>TextBox1.SelectionStart = TextBox1.Text.Length
>TextBox1.ScrollToCaret()



>> here's the problem:
>> i'm running a command-line executable as a managed
>> process from code in a utility i'm developing, and i'm
>> redirecting the standard output from this executable
to a
>> multiline textbox on the form.  since this utility has
to
>> do with file compression, i'm listing all the files
added
>> to the archive and the percent complete in this
textbox.
>> do to the nature of the utility, it can take some time
to
>> complete this process, and hundreds of lines of output
>> may be generated.  i'm adding each line of output that
is
>> applicable by altering the .Lines array.  the problem
is,
>> as i add these new lines to the textbox, it doesn't
>> automatically scroll to the last line, and so the user
>> isn't able to see the most recent files or percent of
>> completion until the process has ended.  IS THERE ANY
WAY
>> TO FORCE THE TEXTBOX TO SCROLL TO THE LAST LINE IN THE
>> LINES ARRAY?  the only method i've found that even
>> remotely applies is the .ScrollToCaret method, which
>> won't work unless i can find a way to move the caret to
>> the last line of the textbox before invoking the
>> method...i've tried using the SendKeys.Send("{DOWN}")
>> method, but that won't work either.  i'm kinda stuck
>> here.  does ANYONE know how to do this??? thanks!

>.



Mon, 27 Jun 2005 02:31:13 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to detect the scroll value of multiline textbox when scrolling by MOUSE

2. How to detect the scroll value of multiline textbox when scrolling by MOUSE

3. scrolling a multiline textbox to the last line as new lines are added...

4. Read a MultiLine textbox line by line?

5. Limitting line length of each line within multiline textbox

6. Textbox/label which add a new line and remove the last line

7. Force the cursor to the last line of RTB

8. Setting scroll position of TextBox with MultiLine

9. Setting scroll position of TextBox with MultiLine

10. Scroll bar problem on Multiline Textbox

11. Multiline Textbox Cause Page Overflows when Printing or doesn't print all lines

12. finding line number cursor is in multiline textbox

 

 
Powered by phpBB® Forum Software