private bool SaveValidation() { bool ressult; try { //if all existing in list if (CMX_City.IsItemInList() && CMX_Area.IsItemInList()) { //check text name of church if (TXT_Church.Text != "") { ressult = true; } else { MessageBox.Show("please enter church name"); TXT_Church.Focus(); ressult = false; } } else { ressult = false; } } catch (Exception) { ressult = false; } return(ressult); }
private void CMX_City_ValueChanged(object sender, EventArgs e) { if (CMX_City.Value != null) { this.tBL_AreaTableAdapter.FillByCity(this.adressDataSet.TBL_Area, long.Parse(CMX_City.Value.ToString())); if (!CMX_Area.IsItemInList()) { CMX_Area.Value = null; if (!CMX_Street.IsItemInList()) { CMX_Street.Value = null; } } } else { this.tBL_AreaTableAdapter.FillByCity(this.adressDataSet.TBL_Area, 0); //if not in list remove it CMX_City.Text = ""; } }
//------------------------------------------------------ private void ComboCIty_ValueChanged(object sender, EventArgs e) { if (ComboCIty.SelectedItem == null) { CMX_Area.Clear(); CMX_Area.Items.Clear(); } else { CMXFillValidation(CMX_Area, ComboCIty, "TBL_Area", "id", "AreaDesc", "City_id"); } }