private void Button_Anki_Sentence_New_Click(object sender, EventArgs e) { Text_Anki_Japanese_Sentence.ReadOnly = false; Text_Anki_Sentence_Mistake.Text = "Пока все правильно. Строка активна."; Text_Anki_Japanese_Sentence.Text = ""; Anki anki = new Anki(this); int max_value = dataGrid_Sentence.RowCount - 1; int sentence_id = anki.Generate_Random_Number(max_value); if (Text_Anki_Sentence_Number.Text != "" && dataGrid_Sentence.RowCount > 2) { while (sentence_id == Convert.ToInt16(Text_Anki_Sentence_Number.Text)) { sentence_id = anki.Generate_Random_Number(max_value); } } Text_Anki_Russian_Sentence.Text = dataGrid_Sentence[2, sentence_id].Value.ToString(); Text_Anki_Sentence_Number.Text = (sentence_id).ToString(); }
private void Button_Anki_New_Click(object sender, EventArgs e) { Anki anki = new Anki(this); int word_id = anki.Generate_Random_Number(dataGrid_Glossary.RowCount - 1); Text_Anki.Text = ""; label_Anki.Text = dataGrid_Glossary[1, word_id].Value.ToString() + " (" + dataGrid_Glossary[2, word_id].Value.ToString() + ")"; Text_Anki_Glossary_ID.Text = word_id.ToString(); Text_Anki.ReadOnly = false; }