private void metroButton1_Click(object sender, EventArgs e) { AddNew an = new AddNew(wks, schools, devices); an.ShowDialog(); if (an.DialogResult == DialogResult.OK) { list.Add(new TestData() { WK = an.WK, Name = an.Namen, Schule = an.Schule, Geraet = an.Geraet, MusikPath = an.MusikPath, Musik = an.Musik }); dataGridViewGrouper1.ResetGrouping(); dataGridViewGrouper1.SetGroupOn(dataGridView1.Columns[0]); } }
private void editierenToolStripMenuItem_Click(object sender, EventArgs e) { try { Int32 rowToDelete = dataGridView1.Rows.GetFirstRow(DataGridViewElementStates.Selected); AddNew en = new AddNew(wks, schools, devices, dataGridView1.Rows[rowToDelete].Cells[3].Value.ToString(), dataGridView1.Rows[rowToDelete].Cells[2].Value.ToString(), dataGridView1.Rows[rowToDelete].Cells[1].Value.ToString(), dataGridView1.Rows[rowToDelete].Cells[0].Value.ToString(), dataGridView1.Rows[rowToDelete].Cells[4].Value.ToString(), dataGridView1.Rows[rowToDelete].Cells[5].Value.ToString()); en.ShowDialog(); if (en.DialogResult == DialogResult.OK) { dataGridView1.Rows[rowToDelete].Cells[3].Value = en.Geraet; dataGridView1.Rows[rowToDelete].Cells[2].Value = en.Schule; dataGridView1.Rows[rowToDelete].Cells[1].Value = en.Namen; dataGridView1.Rows[rowToDelete].Cells[0].Value = en.WK; dataGridView1.Rows[rowToDelete].Cells[4].Value = en.Musik; dataGridView1.Rows[rowToDelete].Cells[5].Value = en.MusikPath; dataGridViewGrouper1.ResetGrouping(); dataGridViewGrouper1.SetGroupOn(dataGridView1.Columns[0]); } } catch { } }