private void pictureBox1_Click(object sender, EventArgs e) { this.Hide(); Form10 f10 = new Form10(); f10.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { string myconnection = "Data Source=DESKTOP-9J170IF;Initial Catalog=Final_Project;Integrated Security=True"; SqlConnection myconn = new SqlConnection(myconnection); string query = "Insert into Services (Services_name, phone_number,number_of_employees,serviceId,month_budget,budget_date) values ('" + this.textBox1.Text + "','" + this.textBox2.Text + "','" + this.textBox3.Text + "','" + this.textBox4.Text + "','" + this.textBox5.Text + "','" + this.textBox6.Text + "');"; SqlCommand cmd = new SqlCommand(query, myconn); SqlDataReader myreader; try { myconn.Open(); myreader = cmd.ExecuteReader(); MessageBox.Show("Saved"); this.Hide(); Form10 f10 = new Form10(); f10.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }