I am writing a bus monitor / protocol analyzer using VS 2005 C++/CLI.

Currently I am using a RichTextBox to display the messages. I am
adding each message with AppendText. This seems to be very slow; the
RichTextBox cannot keep up with the speed at which the messages come
in.

Is there a faster way to append new strings to the RichTextBox?

Alternatively is there a better control to use? The ListView seems to
update a little quicker but does not scroll as smoothly as the
messages are added.

TIA,
KK

RE: Fast control for bus monitor by AMercer

AMercer
Wed Feb 27 12:02:01 CST 2008

> Currently I am using a RichTextBox to display the messages. I am
> adding each message with AppendText. This seems to be very slow; the
> RichTextBox cannot keep up with the speed at which the messages come
> in.
>
> Is there a faster way to append new strings to the RichTextBox?
>
> Alternatively is there a better control to use? The ListView seems to
> update a little quicker but does not scroll as smoothly as the
> messages are added.

You need to batch your updates to optimize performance. With an rtb,
collect some lines (eg with StringBuilder), and AppendText a batch to the
rtb. With a listview, collect some lines and use lv.Items.AddRange. I
suggest a timer to append whatever is batched to the control and have your
analyzer batch its output and not worry about updating the control.