private void dataGridView3_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { if (e.ColumnIndex == 7) { doc = new DodajOcene(); doc.button1.Text = "Edytuj"; doc.Text = "Edytuj Ocenę"; doc.textBox1.Text = dataGridView3.Rows[e.RowIndex].Cells[4].Value.ToString(); doc.ID = dataGridView3.Rows[e.RowIndex].Cells[0].Value.ToString(); doc.Show(); this.Hide(); } if (e.ColumnIndex == 8) { DialogResult dialogResult = MessageBox.Show("Czy chcesz usunąć ocenę " + dataGridView3.Rows[e.RowIndex].Cells[4].Value.ToString() + " z przedmiotu " + dataGridView3.Rows[e.RowIndex].Cells[1].Value.ToString() + " ucznia " + dataGridView3.Rows[e.RowIndex].Cells[2].Value.ToString() + " " + dataGridView3.Rows[e.RowIndex].Cells[3].Value.ToString() + "?", "Potwierdzenie", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Librarycs.UsunOceny(dataGridView3.Rows[e.RowIndex].Cells[0].Value.ToString()); uzupelnianieListyOceny(); } } } }
private void button4_Click(object sender, EventArgs e) { this.Hide(); if (trybIndex == 0) { du = new DodawanieUczen(); du.Show(); } if (trybIndex == 1) { dp = new DodawaniePrzedmiot(); dp.Show(); } if (trybIndex == 2) { doc = new DodajOcene(); doc.Show(); } }