private void PrintAdminRecord(RecordControlAdmin recordControlAdmin) { try { OleDbCommand command = new OleDbCommand("SELECT * FROM [Record]", myConnection); myConnection.Open(); OleDbDataReader reader = command.ExecuteReader(); while (reader.Read()) { RecordElAdmin Item = new RecordElAdmin(); Item.gunaLabel2.Text = reader[0].ToString() + " " + reader[1].ToString(); Item.gunaLabel6.Text = reader[5].ToString(); Item.gunaLabel13.Text = reader[2].ToString(); Item.gunaLabel14.Text = reader[3].ToString(); Item.gunaLabel12.Text = reader[4].ToString(); Item.gunaLabel15.Text = reader[6].ToString(); Item.gunaLabel10.Text = reader[7].ToString(); Item.Size = new Size(671, 38); recordControlAdmin.flowLayoutPanel1.Controls.Add(Item); } reader.Close(); myConnection.Close(); } catch { myConnection.Close(); } }
private void btnAdminRecord_Click(object sender, EventArgs e) { HomePanel.Controls.RemoveAt(0); RecordControlAdmin recordControlAdmin = new RecordControlAdmin(); HomePanel.Controls.Add(recordControlAdmin); recordControlAdmin.Show(); recordControlAdmin.Dock = DockStyle.Fill; recordControlAdmin.BringToFront(); PrintAdminRecord(recordControlAdmin); }