private void BtnAddPosition_Click(object sender, EventArgs e) { TransparentVoters a = new TransparentVoters(); FrmAddVoters b = new FrmAddVoters(); a.Show(); b.ShowDialog(); a.Hide(); }
private void BtnEdit_Click(object sender, EventArgs e) { TransparentVoters b = new TransparentVoters(); FrmAddVoters a = new FrmAddVoters(); try { a.lblvotersrid.Text = lblvotersid.Text; a.BtnAddPosition.Visible = false; con.Close(); con.Open(); String query = "select voters.voters_id, voters.first_name, voters.last_name, voters.middle_name, voters.grade, voters.strand, voters.track, account.username from voters inner join account on voters.account_id = account.account_id where voters_id = @id"; MySqlCommand cmd = new MySqlCommand(query, con); cmd.Parameters.AddWithValue("@id", lblvotersid.Text); MySqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { a.label8.Text = "Edit Voter"; a.lblvotersrid.Text = (dr["voters_id"]).ToString(); a.TxtFirstName.Text = (dr["first_name"]).ToString(); a.TxtLastName.Text = (dr["last_name"]).ToString(); a.TxtMiddleName.Text = (dr["middle_name"]).ToString(); a.TxtFirstName.Enabled = false; a.TxtLastName.Enabled = false; a.TxtMiddleName.Enabled = false; a.TxtGrade.Text = (dr["grade"]).ToString(); a.TxtStrand.Text = (dr["strand"]).ToString(); a.TxtTrack.Text = (dr["track"]).ToString(); a.TxtUsername.Text = (dr["username"]).ToString(); } dr.Close(); con.Close(); b.Show(); a.ShowDialog(); b.Hide(); } catch { NotificationConnectionError c = new NotificationConnectionError(); c.ShowDialog(); } }