lundi 9 mars 2015

How can add a text append text to richTextBox only if the text is different from the one already exist?

I have this method i'm calling every X minutes using a timer.



public void Scroll()
{
listsext.Ext(page);
combindedString = string.Join(Environment.NewLine, ListsExtractions.myList);
richTextBox1.SelectAll();
StringBuilder sb = new StringBuilder();
sb.Append(combindedString);
richTextBox1.SelectionAlignment = HorizontalAlignment.Right;
richTextBox1.AppendText(combindedString);
}


The problem is that now it will keep adding to the richTextBox the content in combindedString over and over again. I need somehow to check each time if the content in combindedString already exist in the richTextBox if not meaning it's new content then AppendText it.


If it's the same already exist do nothing don't add it.


Aucun commentaire:

Enregistrer un commentaire