Exemplo n.º 1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string colName = dataGridView1.Columns[e.ColumnIndex].Name;

            if (colName == "Edit")
            {
                newED ned = new newED(this);
                ned.txtNameP.Text        = dataGridView1[1, e.RowIndex].Value.ToString();
                ned.txtLastN.Text        = dataGridView1[2, e.RowIndex].Value.ToString();
                ned.txtPhoneNo.Text      = dataGridView1[3, e.RowIndex].Value.ToString();
                ned.txtKidName.Text      = dataGridView1[4, e.RowIndex].Value.ToString();
                ned.txtYearsK.Text       = dataGridView1[5, e.RowIndex].Value.ToString();
                ned.comboBox3.Text       = dataGridView1[6, e.RowIndex].Value.ToString();
                ned.comboBox2.Text       = dataGridView1[7, e.RowIndex].Value.ToString();
                ned.comboBox1.Text       = dataGridView1[8, e.RowIndex].Value.ToString();
                ned.dateTimePicker1.Text = dataGridView1[9, e.RowIndex].Value.ToString();
                ned.comboBox4.Text       = dataGridView1[10, e.RowIndex].Value.ToString();
                ned.txtPrice.Text        = dataGridView1[11, e.RowIndex].Value.ToString();
                ned.ShowDialog();
            }
            else if (colName == "Delete")
            {
                if (MessageBox.Show("Da li ste sigurni da zelite da obrisete ovaj rodjendan?", "Obrisan rodjendan", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    cn.Open();
                    cm = new SqlCommand("delete from Rodjendan where ime_roditelja like '" + dataGridView1[1, e.RowIndex].Value.ToString() + "'", cn);
                    cm.ExecuteNonQuery();
                    cn.Close();
                    MessageBox.Show("Rodjendan je uspesno obrisan.", "Rodjendan", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadBirthdays();
                }
            }
        }
Exemplo n.º 2
0
        private void pbOpen_Click(object sender, EventArgs e)
        {
            newED nss = new newED(this);

            nss.ShowDialog();
        }