I am sucessfully capturing all the standard output text from the other
program, but when I try to append text to the textBox control using the
AppendText() method, it only allows 32767 characters. In other words, it
just stops appending text at 32767 characters. I have set the 'MaxLength'
variable to a very high number and it does no good. Like I said, I am using
the AppendText() method (from the TextBoxBase class) so that the textBox
scrollbar position will be at the bottom and not always reset its position
at the top (so you can see the latest output text). If I don't use the
AppendText() method, it works just fine with no limits on the amount of
text, but always resets itself to the top so you don't see the latest text,
always just the beginning text.
Download Lutz Roeder's .NET Reflector (http://www.aisto.com/roeder/dotnet/)
if you want to see what's happening inside the framework (it's easier to
read than ILDASM)
/claes
"Chad Christensen" <Chad.Chr...@hill.af.mil> wrote in message
news:u4DdZHzP...@TK2MSFTNGP10.phx.gbl...
How do I always display the end of the output as it's being added? I can't
believe this is so hard. This is such a common thing to do, i.e. show the
output as it's being added at the bottom and not the top. This is very
frustrating to me because it should be so simple. Any help would be
appreciated. :)
Thanks,
Chad Christensen
"Claes Bergefall" <claes.berge...@frontec.se> wrote in message
news:%23vLz$B9PDH...@TK2MSFTNGP10.phx.gbl...
If you still want to use a TextBox you can always bypass
the framework and send the messages directly to it. Try this
(whatch for line wrapping)
Public Const EM_REPLACESEL As Integer = &HC2
Public Const EM_SETMODIFY As Integer = &HB9
Public Overloads Declare Auto Function SendMessage Lib "User32.dll" ( _
ByVal hwnd As IntPtr, _
ByVal msg As Integer, _
ByVal wParam As IntPtr, _
ByVal lParam As IntPtr) As Integer
Public Overloads Declare Auto Function SendMessage Lib "User32.dll" ( _
ByVal hwnd As IntPtr, _
ByVal msg As Integer, _
ByVal wParam As IntPtr, _
<System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.Unm
anagedType.LPTStr)> ByVal lParam As String) As Integer
Private Sub AppendText(ByVal textBox As TextBox, ByVal text As String)
If textBox.IsHandleCreated Then
textBox.Select(textBox.TextLength, textBox.TextLength)
SendMessage(textBox.Handle, EM_REPLACESEL, New IntPtr(-1), text)
SendMessage(textBox.Handle, EM_SETMODIFY, New IntPtr(0),
IntPtr.Zero)
Else
textBox.AppendText(text)
End If
End Sub
/claes
"Chad Christensen" <Chad.Chr...@hill.af.mil> wrote in message
news:eUy7#u9PDH...@tk2msftngp13.phx.gbl...
However, yesterday (July 1, 2003) I found a property called "HideSelection"
that is part of the TextBoxBase class and it makes the scrolling work as
expected (always seeing the latest text added to the box) if it is set to
False. The default for this property is True. So I finally found a
solution! I copied your code to bypass the framwork in case I ever need it.
Thanks again!
Chad Christensen
"Claes Bergefall" <claes.berge...@frontec.se> wrote in message
news:uusMq9G...@TK2MSFTNGP10.phx.gbl...