private void InicializeDataGrid() { if (dg_print_words.Columns.Count != 0) { dg_print_words.Columns.Clear(); } if (dg_print_words.Items.Count != 0) { dg_print_words.Items.Clear(); } AddColumns(); DataTable All_Voc = dtb_t.Get_All_IDs_Voc(); foreach (DataRow row in All_Voc.Rows) { Vocabulary czeVoc = dtb_t.Get_Czech_Voc_By_Id(Convert.ToInt32(row.ItemArray[1])); Vocabulary engVoc = dtb_t.Get_English_Voc_By_Id(Convert.ToInt32(row.ItemArray[2])); this.dg_print_words.Items.Add(new RowWord { Id = (int)row.ItemArray[0], podst_jm = czeVoc.Noun, prid_jm = czeVoc.Adjective, Sloveso = czeVoc.Verb, Noun = engVoc.Noun, Adjective = engVoc.Adjective, Verb = engVoc.Verb });;; } }
//Load words from database public void ReloadWords() { if (List_AllWords.Count != 0) { this.List_AllWords.Clear(); } DataTable All_Voc = dt.Get_All_IDs_Voc(); foreach (DataRow row in All_Voc.Rows) { Vocabulary czeVoc = dt.Get_Czech_Voc_By_Id(Convert.ToInt32(row.ItemArray[1])); Vocabulary engVoc = dt.Get_English_Voc_By_Id(Convert.ToInt32(row.ItemArray[2])); this.List_AllWords.Add(new RowWord { podst_jm = czeVoc.Noun, prid_jm = czeVoc.Adjective, Sloveso = czeVoc.Verb, Noun = engVoc.Noun, Adjective = engVoc.Adjective, Verb = engVoc.Verb });;; } bt_nextWord_Click(null, null); }