private void button1_Click(object sender, EventArgs e) { string error_caption = "Error"; if (string.IsNullOrEmpty(EmployeeName.Text)) { var emp_error = MessageBox.Show("Employee Name cannot be left empty", error_caption, MessageBoxButtons.OK); EmployeeName.Focus(); } else if (!BirthDate.MaskCompleted || !BirthDate.MaskFull) { var emp_error = MessageBox.Show("Birth date is not filled or not finished yet", error_caption, MessageBoxButtons.OK); BirthDate.Focus(); } else if (string.IsNullOrEmpty(Address.Text)) { var emp_error = MessageBox.Show("Address is cannot be left empty", error_caption, MessageBoxButtons.OK); Address.Focus(); } else if (City.SelectedIndex < 0) { var emp_error = MessageBox.Show("Please choose a city", error_caption, MessageBoxButtons.OK); City.Focus(); } else if (Country.SelectedIndex < 0) { var emp_error = MessageBox.Show("Please choose your nation", error_caption, MessageBoxButtons.OK); Country.Focus(); } else if (Qualification.SelectedIndex < 0) { var emp_error = MessageBox.Show("Please choose your highest qualification", error_caption, MessageBoxButtons.OK); Qualification.Focus(); } else if (!Phone.MaskCompleted) { var emp_error = MessageBox.Show("Please enter your phone number", error_caption, MessageBoxButtons.OK); Phone.Focus(); } else if (string.IsNullOrEmpty(Email.Text)) { var emp_error = MessageBox.Show("Please enter your Email", error_caption, MessageBoxButtons.OK); Email.Focus(); } else if (JoinDate.Text.Length == 0) { var emp_error = MessageBox.Show("When did you join this company?", error_caption, MessageBoxButtons.OK); JoinDate.Focus(); } else { string message = "Employee Name: " + this.EmployeeName.Text + "\nDate of birth: " + this.BirthDate.Text + "\nAddress: " + this.Address.Text + "\nCity: " + this.City.Text + "\nCountry: " + this.Country.Text + "\nQualification: " + this.Qualification.Text + "\nPhone: " + this.Phone.Text + "\nEmail: " + this.Email.Text + "\nDate of joining: " + this.JoinDate.Text; string caption = "Information detail"; var result = MessageBox.Show(message, caption, MessageBoxButtons.OK); } }