Sunday, March 29, 2015

Pruning text box contents: Ideas?

Hi all,


I've got a text box in a C#2010 app that I use as a console. The user enters commands here and the app dumps what ever results are generated into this text box also. After doing some serious testing the text box seemed to stop responding by not allowing any more characters to be entered. After some research I found that the max length of the text box, in how many characters can be out into it, is 32K.


I am working on how to resolve this. I would like to monitor the text box length and when it reaches about 85% capacity I would like to prune its contents. I do not want to clear it because it may contain information that the user might want to see again. I would like to take 80% from the top and remove that, keeping intact the bottom 20%.


I do not have a problem monitoring the text box or identifying the exact text to remove, but would like some help in determining the best way to remove the text. This will be a large amount of text and would like to know which is the most effective way to do this. I could do something like this:



textbox.text = textbox.text.substring(iStartKeeptextPos);



But, is this really the optimized way to do it? As always, thank you for your help. Saga




You can't take the sky from me


No comments:

Post a Comment