private void btnadd_Click(object sender, EventArgs e) { ClsSqlServer objinsert = new ClsSqlServer(); if (txtapartiment.Text == "" || txtfname.Text == "" || txtlname.Text == "" || cmbgender.Text == "" || txtphone.Text == "" || cmbpayment.Text == "") { MessageBox.Show("Make sure you fill every field!"); } else { try { objinsert.InsertCustomer(txtapartiment.Text, txtfname.Text, txtlname.Text, cmbgender.Text, txtphone.Text, cmbpayment.Text, dTPicker1.Value); MessageBox.Show("Data Inserted Successfully"); txtapartiment.Text = ""; txtfname.Text = ""; txtlname.Text = ""; cmbgender.Text = ""; txtphone.Text = ""; cmbpayment.Text = ""; dTPicker1.Value = DateTime.Today; //} } catch { // return false; MessageBox.Show("This unit is currently in use, choose another one", "Error"); txtapartiment.Focus(); } } }