Ejemplo n.º 1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                if (e.ColumnIndex == 3)
                {
                    du = new DodawanieUczen();
                    du.button1.Text  = "Edytuj";
                    du.Text          = "Edytuj ucznia";
                    du.textBox1.Text = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
                    du.textBox2.Text = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString();
                    du.ID            = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
                    du.Show();
                    this.Hide();
                }
                if (e.ColumnIndex == 4)
                {
                    DialogResult dialogResult = MessageBox.Show("Czy chcesz usunąć " + dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() + " " + dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString() + "?", "Potwierdzenie", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        Librarycs.UsunStudent(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
                        uzupelnianieListyUczniowie();
                    }
                }
            }
        }
Ejemplo n.º 2
0
 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();
     }
 }