private void form_services_Load(object sender, EventArgs e) { AddS.Enabled = true; Reset.Enabled = true; EditS.Enabled = false; DeleteS.Enabled = false; loadAll(); S1.Hide(); S2.Hide(); label1.Hide(); label2.Hide(); string select = "SELECT max(trt_id) from dc_trtmnt"; conn.Open(); MySqlCommand comm = new MySqlCommand(select, conn); MySqlDataAdapter adp = new MySqlDataAdapter(comm); comm.ExecuteNonQuery(); conn.Close(); DataTable dt = new DataTable(); adp.Fill(dt); if (dt.Rows.Count == 1) { int treat_id = (int)dt.Rows[0][0]; int add1 = treat_id + 1; label1.Text = "SC0" + add1; src_id.Text = label1.Text; src_id.Enabled = false; } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (cmb_src.Text == "All Fields*") { loadAll(); S1.Hide(); S2.Hide(); } else if (cmb_src.Text == "Treatment Name") { S1.Show(); S2.Show(); } else if (cmb_src.Text == "Price") { S1.Show(); S2.Show(); } }