private void moveDownButton_Click(object sender, EventArgs e) { DataGridView dgv = audioPathDataGridView; DGVManipulation.MoveDGVRowDown(dgv); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { this.dataGridView1.DataSource = null; this.dataGridView1.Rows.Clear(); string[] line; string[] filePaths = null; try { dataGridView1.Rows.Clear(); dataGridView1.Refresh(); line = StroopProgram.readDataFile(path + "/" + resultComboBox.SelectedItem.ToString() + ".txt"); if (line.Count() > 0) { for (int i = 0; i < line.Count(); i++) { string[] cellArray = line[i].Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); if (cellArray.Length == dataGridView1.Columns.Count) { dataGridView1.Rows.Add(cellArray); for (int j = 5; j < cellArray.Length; j++) { if (Validations.isHexPattern(cellArray[j])) { dataGridView1.Rows[i].Cells[j].Style.BackColor = ColorTranslator.FromHtml(cellArray[j]); } } } else if (cellArray.Length == (dataGridView1.ColumnCount - 1)) { var index = line[i].IndexOf("\t"); if (index >= 0) { line[i] = line[i].Insert(index + "\t".Length, "-\t"); } cellArray = line[i].Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); dataGridView1.Rows.Add(cellArray); for (int j = 5; j < cellArray.Length; j++) { if (Validations.isHexPattern(cellArray[j])) { dataGridView1.Rows[i].Cells[j].Style.BackColor = ColorTranslator.FromHtml(cellArray[j]); } } } } } // fills audio data grid view with .wav files in directory in case there are any matching the patter on combobox if (Directory.Exists(path)) { if (audioPathDataGridView.RowCount > 0) { audioPathDataGridView.Rows.Clear(); audioPathDataGridView.Refresh(); } filePaths = Directory.GetFiles(path, "audio_" + resultComboBox.SelectedItem.ToString() + "*", SearchOption.AllDirectories); DGVManipulation.ReadStringListIntoDGV(filePaths, audioPathDataGridView); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }