Link to home
Start Free TrialLog in
Avatar of sdom100
sdom100

asked on

Implement a sliding window textbox

Hi,
I am looking for the most efficient way to create a textbox to monitor comms data.

I need to limit it's size to 100 lines so when a new line arrives, it is added to the bottom and if the no. lines in the textbox >100 the first one is removed.

The behaviour would be similar to that of the hyperterminal window (cant see all data just latest x lines).

I need to do this in a highly performant manner.
Please advise on the best way to go about it. ps. not wedded to a text box so use another control if it suits.

(using visual studio 2005)

thanks.
Shaun
ASKER CERTIFIED SOLUTION
Avatar of alex_paven
alex_paven
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Dmitry G
Dmitry G
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sdom100
sdom100

ASKER

My latest approach was to go with the listbox as suggested and simply use the add, check the items.count if >100 then use the RemoveAt function to take off the first line.
Which is most efficient ? (this way or using binding as per your suggestions) ?

Thanks,
Shaun
Hard to say without testing, but I'd say the difference is minimal; the same mechanisms are used in both cases.