コード例 #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     EditTypeForm editForm = new EditTypeForm();
     editForm.Show();
 }
コード例 #2
0
        private void EditRecord(int rowIndex)
        {
            try
            {
                if (comboBox1.Text.Equals("Types"))
                {
                    int id = (int)dataGridView1.Rows[rowIndex].Cells["id"].Value;
                    string name = (string)dataGridView1.Rows[rowIndex].Cells["name"].Value;
                    string description = (string)dataGridView1.Rows[rowIndex].Cells["description"].Value;
                    int renew = (int)dataGridView1.Rows[rowIndex].Cells["renewal"].Value;

                    EditTypeForm etf = new EditTypeForm(id, name, description, renew);
                    etf.Show();

                }
                else
                {
                    int id = (int)dataGridView1.Rows[rowIndex].Cells["id"].Value;
                    string fname = (string)dataGridView1.Rows[rowIndex].Cells["fname"].Value;
                    string lname = (string)dataGridView1.Rows[rowIndex].Cells["lname"].Value;
                    DateTime dob = (DateTime)dataGridView1.Rows[rowIndex].Cells["dob"].Value;

                    EditPersonnelForm epf = new EditPersonnelForm(id, fname, lname, dob);
                    epf.Show();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Error: Invalid selection, please try again.");
            }
        }