private void btn_Run_Click(object sender, EventArgs e) { listBox_Result.Items.Clear(); result_words.Clear(); textBox_Result.Clear(); Handler.InputParametrs(words, cubes, cubes_amount); textBox_Result.Text = Handler.Run(ref result_words).ToString(); if (result_words.Count > 0) { foreach (string wrd in result_words) { listBox_Result.Items.Add(wrd); } } }
//запуск private void btn_Run_Click(object sender, EventArgs e) { if (CellsNotIsEmpty()) { if (listBox_dictionary.Items.Count != 0) { for (int i = 0; i < listBox_dictionary.Items.Count; i++) { words.Add(listBox_dictionary.Items[i].ToString()); } cubes = new string[dataGridView_Cubes.RowCount, 6]; for (int i = 0; i < dataGridView_Cubes.RowCount - 1; i++) { for (int j = 0; j < dataGridView_Cubes.ColumnCount; j++) { cubes[i, j] = dataGridView_Cubes.Rows[i].Cells[j].Value.ToString(); } } listBox_Result.Items.Clear(); result_words.Clear(); Handler = new CubesHandler(words, cubes, cubes_amount); lbl_count_words.Text = "Результат: " + Handler.Run(ref result_words).ToString(); if (result_words.Count > 0) { foreach (string wrd in result_words) { listBox_Result.Items.Add(wrd); } } } else { MessageBox.Show(this, "Словарь не может быть пустым!", "Некорректные данные!"); } } else { MessageBox.Show(this, "Ячейки таблицы не могут быть пустыми!", "Некорректные данные!"); } }