コード例 #1
0
        private void BtnRegister_Click(object sender, EventArgs e)
        {
            TransparentCandidate a = new TransparentCandidate();
            FrmRegisterCandidate b = new FrmRegisterCandidate();

            a.Show();
            b.ShowDialog();
            a.Hide();
        }
コード例 #2
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            TransparentCandidate b = new TransparentCandidate();
            FrmRegisterCandidate a = new FrmRegisterCandidate();

            try
            {
                a.lblcandidateid.Text        = lblcandidate.Text;
                a.TxtStudentFName.Enabled    = false;
                a.TxtStudentMName.Enabled    = false;
                a.TxtStudentLName.Enabled    = false;
                a.BtnRegisterTeacher.Visible = false;
                con.Close();
                con.Open();
                String       query = "select * from candidate where candidate_id = @id";
                MySqlCommand cmd   = new MySqlCommand(query, con);
                cmd.Parameters.AddWithValue("@id", lblcandidate.Text);
                MySqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    try
                    {
                        byte[]       img = (byte[])(dr["img"]);
                        MemoryStream ms  = new MemoryStream(img);
                        a.StudentPicture.Image = Image.FromStream(ms);
                    }
                    catch
                    {
                    }
                    a.label8.Text          = "Edit Candidate";
                    a.lblcandidateid.Text  = (dr["candidate_id"]).ToString();
                    a.TxtStudentLName.Text = (dr["last_name"]).ToString();
                    a.TxtStudentMName.Text = (dr["middle_name"]).ToString();
                    a.TxtStudentFName.Text = (dr["first_name"]).ToString();
                    String gender = (dr["gender"]).ToString();
                    if (gender == "Male")
                    {
                        a.GenderMaleCheckBox.Checked = true;
                    }
                    else if (gender == "Female")
                    {
                        a.GenderFemaleCheckBox.Checked = true;
                    }
                    a.TxtAge.Text       = (dr["age"]).ToString();
                    a.TxtGrade.Text     = (dr["grade"]).ToString();
                    a.TxtTrack.Text     = (dr["track"]).ToString();
                    a.TxtStrand.Text    = (dr["strand"]).ToString();
                    a.TxtPartylist.Text = (dr["partylist"]).ToString();
                    a.TxtPosition.Text  = (dr["position"]).ToString();
                    a.TxtPlatform.Text  = (dr["platform"]).ToString();
                }
                dr.Close();
                con.Close();
                b.Show();
                a.ShowDialog();
                b.Hide();
            }
            catch
            {
                NotificationConnectionError c = new NotificationConnectionError();
                c.ShowDialog();
            }
        }