I have a client app in c# winforms that, among other tasks, receives real time logs from another app over a tcp socket. If I just add the log text to a richtextbox, the application is quickly bogged down. Obviously the user can’t read text at the rate its coming in, but we have to ability to stop and start the system so we can look back through the logs.
Is there a better choice than richtextbox? I would like to retain the ability to color text and the ability to scroll back through the log. Would something in WPF work better?
I have a client app in c# winforms that, among other tasks, receives real
Share
You can add all the lines to a List which can look something like this:
and use a control which supports virtualization to display the LogLines. You can also create your own by using for example 10 Labels/TextBlocks which you manually assign values from the List based on scrollposition.
The solution will eat memory if you let the list grow unlimited. If you need huge logs, you should use the filesystem to save data and truncate the list periodically.