Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult yn = MessageBox.Show("Generate Report?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);

            if (yn == DialogResult.Yes)
            {
                scout_report form9 = new scout_report();
                form9.ShowDialog();
            }
        }
        private void button7_Click(object sender, EventArgs e)
        {
            scout_report sr = new scout_report();

            if (dataGridView1.SelectedRows.Count > 0)
            {
                sr.gzr     = dataGridView1.CurrentRow.Cells[0].Value.ToString();
                sr.name    = dataGridView1.CurrentRow.Cells[2].Value.ToString();
                sr.idbsa   = dataGridView1.CurrentRow.Cells[3].Value.ToString();
                sr.dob     = (DateTime)dataGridView1.CurrentRow.Cells[4].Value;
                sr.fname   = dataGridView1.CurrentRow.Cells[8].Value.ToString();
                sr.cont    = dataGridView1.CurrentRow.Cells[10].Value.ToString();
                sr.cnic    = dataGridView1.CurrentRow.Cells[11].Value.ToString();
                sr.email   = dataGridView1.CurrentRow.Cells[12].Value.ToString();
                sr.bg      = dataGridView1.CurrentRow.Cells[13].Value.ToString();
                sr.address = dataGridView1.CurrentRow.Cells[14].Value.ToString();
                DialogResult yn = MessageBox.Show("Generate report for scout " + sr.name + " ?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);
                if (yn == DialogResult.Yes)
                {
                    if (this.title == "Shaheen Scouts")
                    {
                        sr.unit  = 1;
                        sr.title = "Shaheen Scouts";
                    }
                    else if (this.title == "Boys Scouts")
                    {
                        sr.unit  = 2;
                        sr.title = "Boys Scouts";
                    }
                    else if (this.title == "Rover Scouts")
                    {
                        sr.unit  = 3;
                        sr.title = "Rover Scouts";
                    }
                    sr.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("You must select a row in order to view report! ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }