private void btnReadTerms_Click(Object eventSender, EventArgs eventArgs) { StringBuilder aWord = new StringBuilder(); string LineOfText = ""; string Spelling = ""; int WordsAdded = 0; btnReadTerms.Enabled = false; Cursor = Cursors.WaitCursor; Application.DoEvents(); string[] LineArray = File.ReadAllLines(Path.Combine(Application.StartupPath, "ImportWords.txt")); foreach (string Line in LineArray) { // Get a line of text LineOfText = Line; LineOfText = LineOfText + " "; // Remove all but letters. int tempForEndVar = LineOfText.Length; for (int xChar = 1; xChar <= tempForEndVar; xChar++) { string switchVar = LineOfText.Substring(xChar - 1, Math.Min(1, LineOfText.Length - (xChar - 1))); if (String.CompareOrdinal(switchVar, "A") >= 0 && String.CompareOrdinal(switchVar, "Z") <= 0) { } else if (String.CompareOrdinal(switchVar, "a") >= 0 && String.CompareOrdinal(switchVar, "z") <= 0) { } else { LineOfText = Strings.Mid(LineOfText, xChar, 1, " "); } } // Find words. int tempForEndVar2 = LineOfText.Length; for (int xChar = 1; xChar <= tempForEndVar2; xChar++) { string switchVar_2 = LineOfText.Substring(xChar - 1, Math.Min(1, LineOfText.Length - (xChar - 1))); if (String.CompareOrdinal(switchVar_2, "A") >= 0 && String.CompareOrdinal(switchVar_2, "Z") <= 0) { aWord.Append(LineOfText.Substring(xChar - 1, Math.Min(1, LineOfText.Length - (xChar - 1)))); } else if (String.CompareOrdinal(switchVar_2, "a") >= 0 && String.CompareOrdinal(switchVar_2, "z") <= 0) { aWord.Append(LineOfText.Substring(xChar - 1, Math.Min(1, LineOfText.Length - (xChar - 1)))); } else { //Mid$(LineOfText, xChar, 1) = " " aWord = new StringBuilder(aWord.ToString().ToLower()); if (String.CompareOrdinal(aWord.ToString().Trim(), "") > 0) { Spelling = Module1.ReadDict("Words", aWord.ToString().Trim(), "NoEntry").Trim(); if (Spelling == "NoEntry") { txtDictionary.SelectionStart = txtDictionary.Text.Length + 1; txtDictionary.SelectedText = aWord.ToString() + "=" + Environment.NewLine; WordsAdded++; } aWord = new StringBuilder(""); } } } } ; btnReadTerms.Enabled = true; Cursor = Cursors.Default; Application.DoEvents(); MessageBox.Show(WordsAdded.ToString() + " Words added", "Import Status"); }