private void txt_lastName_TextChanged(object sender, EventArgs e) { if (txt_lastName.Text.Length == 0) { Error_empInfo.SetError(txt_lastName, "Employee Name required"); } else { if (txt_lastName.Text.Length >= 3) { formValidator3.Clear(); Error_empInfo.Clear(); } } }
private void txt_city_TextChanged(object sender, EventArgs e) { if (txt_city.Text.Length == 0) { Error_empInfo.SetError(txt_city, "Address should be filled"); } else { if (txt_city.Text.Length >= 3) { formValidator3.Clear(); Error_empInfo.Clear(); } } }
private void txt_mobile_TextChanged(object sender, EventArgs e) { formValidator3.Clear(); // to make sure that error provider is emppty if (txt_mobile.Text.Length > 10) { Error_empInfo.SetError(txt_mobile, "invalid mobile number.check again"); }//end of the mobile number will more than 10 digits else if (txt_mobile.Text.Length < 10) { Error_empInfo.SetError(txt_mobile, "invalid mobile number.check again"); } else { Error_empInfo.Clear(); } }
private void txt_firstName_TextChanged(object sender, EventArgs e) { if (txt_firstName.Text.Length == 0) { Error_empInfo.SetError(txt_firstName, "Supplier Name required"); } else { if (txt_firstName.Text.Length >= 3) { formValidator3.Clear(); Error_empInfo.Clear(); } } Thread th = new Thread(new ThreadStart(genarateSupplierID)); th.Start(); }
private void btn_save_Click(object sender, EventArgs e) { if (!((txt_firstName.Text.Equals(null)) && (txt_lastName.Text.Equals(null)) && (txt_companyName.Text.Equals(null)) && (txt_line1.Text.Equals(null)) && (txt_line2.Text.Equals(null)) && (txt_contactNum.Text.Equals(null)))) { string sql; sql = "Insert into supplier_table(supp_ID,supp_FirstName,supp_lastName,company_Name,company_Address,contactNumber,NIC,emailAddress,RegisteredDate,fax_Num,web_siteName,Comments)" + "Values('" + txt_suppID.Text + "','" + txt_firstName.Text + "','" + txt_lastName.Text + "','" + txt_companyName.Text + "','" + ((txt_line1.Text) + (txt_line2.Text) + (txt_city.Text)) + "','" + txt_contactNum.Text + "','" + txt_nic.Text + "','" + txt_email.Text + "','" + dtp_regDate.Value.ToString() + "','" + txt_faxNum.Text + "','" + txt_siteName.Text + "','" + rtxt_comments.Text + "')"; int line = db.update_del_insert_Data(sql); db.closeCon(); if (line == 1) { MessageBox.Show("Supplier successfully saved", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); txt_firstName.Clear(); txt_lastName.Clear(); txt_companyName.Clear(); txt_line1.Clear(); txt_line2.Clear(); txt_city.Clear(); txt_contactNum.Clear(); txt_nic.Clear(); txt_email.Clear(); txt_faxNum.Clear(); txt_siteName.Clear(); rtxt_comments.Clear(); txt_suppID.Clear(); FormValidator.Clear(); FormValidator2.Clear(); formValidator3.Clear(); Error_empInfo.Clear(); } else { MessageBox.Show("Supplier register process is failed.Please try again thank you", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Please check the form and try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }