private void addCustomersToolStripMenuItem_Click(object sender, EventArgs e) { panelMain.Controls.Clear(); Add_customer AddCust = new Add_customer(); AddCust.TopLevel = false; AddCust.Visible = true; panelMain.Controls.Add(AddCust); }
private void btnFindCustoAddItem_Click(object sender, EventArgs e) { Main.p1.Controls.Clear(); Add_customer adcus = new Add_customer(); adcus.TopLevel = false; adcus.Visible = true; Main.p1.Controls.Add(adcus); }
private void toolStripButton5_Click(object sender, EventArgs e) { panelMain.Controls.Clear(); Add_customer AddCust = new Add_customer(); AddCust.TopLevel = false; AddCust.Visible = true; panelMain.Controls.Add(AddCust); Add_customer.tx_fnmc.Focus(); }
private void btnAddCustoAdd_Click(object sender, EventArgs e) { ep_fname.SetError(txtAddCustoFirstName, ""); ep_lname.SetError(txtLastAddCustoName, ""); ep_add1.SetError(txtAddCustoAddLine1, ""); ep_add2.SetError(txtAddCustoAddLine2, ""); ep_mobil.SetError(txtAddCustoMobile, ""); try { if (txtAddCustoFirstName.Text != "" && txtLastAddCustoName.Text != "" && txtAddCustoMobile.Text != "" && txtAddCustoAddLine1.Text != "" && txtAddCustoAddLine2.Text != "") { if (reg_names.IsMatch(txtAddCustoFirstName.Text)) { if (reg_names.IsMatch(txtLastAddCustoName.Text)) { if (reg_mobile.IsMatch(txtAddCustoMobile.Text)) { CusOp.insert(lbl_Addcus_No.Text, txtAddCustoFirstName.Text, txtLastAddCustoName.Text, txtAddCustoBussinessName.Text, txtAddCustoAddLine1.Text, txtAddCustoAddLine2.Text, txtAddCustoCity.Text, txtAddCustoZipPostCode.Text, txtAddCustoPhone.Text, txtAddCustoMobile.Text, txtAddCustoFax.Text, txtAddCustoDiscount.Text, txtAddCustoEmail.Text, txtAddCustoNotes.Text); if (MessageBox.Show("Customer Added Successfuly.", "New Customer", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { //-----------------clear all textbox.text----------------------- Action <Control.ControlCollection> func = null; func = (controls) => { foreach (Control control in controls) { if (control is TextBox) { (control as TextBox).Clear(); } else { func(control.Controls); } } }; func(Controls); Main.p1.Controls.Clear(); Add_customer d1 = new Add_customer(); d1.TopLevel = false; d1.Visible = true; Main.p1.Controls.Add(d1); } } else { tp_mob.Show("Enter Correct Mobile Number\nMobile must have 10 Number", txtAddCustoMobile, 3000); } } else { tp_lnme.Show("Enter Last Name in alphanumeric characters", txtLastAddCustoName, 3000); } } else { tp_fmne.Show("Enter First Name in alphanumeric characters", txtAddCustoFirstName, 3000); } } else { if (txtAddCustoFirstName.Text == "") { ep_fname.SetError(txtAddCustoFirstName, "Enter customer First name "); } if (txtLastAddCustoName.Text == "") { ep_lname.SetError(txtLastAddCustoName, "Enter customer last name "); } if (txtAddCustoAddLine1.Text == "") { ep_add1.SetError(txtAddCustoAddLine1, "Enter customer Address line1 "); } if (txtAddCustoAddLine2.Text == "") { ep_add2.SetError(txtAddCustoAddLine2, "Enter customer Address line2 "); } if (txtAddCustoMobile.Text == "") { ep_mobil.SetError(txtAddCustoMobile, "Enter customer Mobile No "); } } } catch (Exception) { MessageBox.Show("Enter Correct data", "Sharp Creation", MessageBoxButtons.OK, MessageBoxIcon.Error); } }