private void Form3_Load(object sender, EventArgs e) { this.Text = "Отсортированный"; string line = ""; for (int i = 0; i < form.dataGridView1.RowCount; i++) { line += form.dataGridView1[0, i].Value + " "; } AonedimensionalArray arr = new AonedimensionalArray(line); richTextBox1.Text = line; richTextBox1.Text += "\n"; if (choice == 2) { arr.Sort1(); } if (choice == 1) { arr.Sort2(); } line = " "; for (int i = 0; i < arr.Lenght; i++) { line += arr[i] + " "; } line = line.Trim(); richTextBox1.Text += line; }
private void Form3_Load(object sender, EventArgs e) { this.Text = "Отсортированный"; string line = ""; var arr = AonedimensionalArray.GetCollectionFromDataGridView(form.dataGridView1); richTextBox1.Text = line; richTextBox1.Text += "\n"; if (choice == 2) { arr.SortUp(); } if (choice == 1) { arr.SortDown(); } line = " "; for (int i = 0; i < arr.Count; i++) { line += arr[i] + " "; } line = line.Trim(); richTextBox1.Text += line; }
private void СуммаToolStripMenuItem_Click(object sender, EventArgs e) { string line = " "; for (int i = 0; i < dataGridView1.RowCount; i++) { line += dataGridView1[0, i].Value + " "; } AonedimensionalArray arr = new AonedimensionalArray(line); MessageBox.Show($"сумма:{arr.Sum()}", "Сумма", MessageBoxButtons.OK); }
private void СуммаToolStripMenuItem_Click(object sender, EventArgs e) { string line = " "; for (int i = 0; i < dataGridView1.RowCount; i++) { line += dataGridView1[0, i].Value + " "; } var result = AonedimensionalArray.GetCollectionFromDataGridView(dataGridView1); var sum = AonedimensionalArray.Sum(result); MessageBox.Show($"сумма:{sum}", "Сумма", MessageBoxButtons.OK); }
private void Button1_Click(object sender, EventArgs e) { string line = " "; for (int i = 0; i < form.dataGridView1.RowCount; i++) { line += form.dataGridView1[0, i].Value + " "; } AonedimensionalArray arr = new AonedimensionalArray(line); int x = Convert.ToInt32(textBox1.Text); int y = Convert.ToInt32(textBox2.Text); if (x == 0 && y == 0) { MessageBox.Show($"Количество:{arr.Search()}", "Количество", MessageBoxButtons.OK); } else { MessageBox.Show($"Количество:{arr.Search(x, y)}", "Количество", MessageBoxButtons.OK); } Close(); }