// seperate method to call list of synonyms from a word (can be used by any class that has a Database class object)
        public List <string> GetSynonyms(string term)
        {
            List <string> list = new List <string>();

            try
            {
                NewWordsDataSet.WordsRow wordsRow = nwDataSet.Words.FindByWord(term);

                if (wordsRow != null)
                {
                    string[] strList = wordsRow.Synonyms.ToString().Split(',');
                    foreach (string s in strList)
                    {
                        list.Add(s);
                    }
                }
                else
                {
                    list = null;
                }
            }
            catch (Exception error)
            {
                MessageBox.Show("An error has occured: " + error);
            }

            return(list);
        }
Beispiel #2
0
 private void updateButton_Click(object sender, EventArgs e)
 {
     try
     {
         NewWordsDataSet.WordsRow wordsRow = newWordsDataSet.Words.FindByWord(updateWord.Text);
         wordsRow.Synonyms = updateSynonyms.Text;
         MessageBox.Show("Updated Row");
     }
     catch (Exception error)
     {
         MessageBox.Show("An Error has occured " + error);
     }
 }
Beispiel #3
0
 private void removeButton_Click(object sender, EventArgs e)
 {
     try
     {
         NewWordsDataSet.WordsRow wordsRow = newWordsDataSet.Words.FindByWord(deleteWord.Text);
         wordsRow.Delete();
         MessageBox.Show("Deleted Row!");
     }
     catch (Exception error)
     {
         MessageBox.Show("An Error has occured " + error);
     }
 }
 public void UpdateEntry(string word, string synonyms)
 {
     try
     {
         NewWordsDataSet.WordsRow wordsRow = nwDataSet.Words.FindByWord(word.ToLower());
         wordsRow.Synonyms = synonyms.ToLower();
         MessageBox.Show("Updated entry!");
     }
     catch (Exception error)
     {
         MessageBox.Show("An error occured: " + error);
     }
 }
 public void DeleteEntry(string word)
 {
     try
     {
         NewWordsDataSet.WordsRow wordsRow = nwDataSet.Words.FindByWord(word.ToLower());
         wordsRow.Delete();
         MessageBox.Show("Deleted entry!");
     }
     catch (Exception error)
     {
         MessageBox.Show("An error occured: " + error);
     }
 }
Beispiel #6
0
 private void queryResults(string word)
 {
     NewWordsDataSet.WordsRow wordsRow = newWordsDataSet.Words.FindByWord(word);
     if (wordsRow != null)
     {
         string[] synList = wordsRow.Synonyms.ToString().Split(',');
         string   str     = "";
         foreach (string s in synList)
         {
             str += s + "\r\n";
         }
         querySynonyms.Text = str;
     }
     else
     {
         querySynonyms.Text = "No Results";
     }
 }