private void RemoveWord(string word) { trie.Delete(word); string logText = txtLog.Text; string logNewText = String.Empty; if (!String.IsNullOrEmpty(logText)) { string[] lines = logText.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); for (int i = 0, len = lines.Length; i < len; i++) { string currWord = lines[i]; if (currWord != word) { if (i == 0) { logNewText = currWord; } else { logNewText += Environment.NewLine + currWord; } } } txtLog.Text = logNewText; } }