private void TxtSearchQuery_Validating(object sender, CancelEventArgs e) { // Valid if at least one character is entered. if (TxtSearchQuery.TextLength > 0) { invalidControls &= ~ValidatingControls.TxtSearchQuery; // Clear bit } else { invalidControls |= ValidatingControls.TxtSearchQuery; // Set bit } }
private void GrpLookAt_Validating(object sender, CancelEventArgs e) { // Valid if at least one checkbox from each category is checked. if ((ChkSearchInSends.Checked || ChkSearchInRecvs.Checked) && // Category 1 (ChkSearchInOps.Checked || ChkSearchInIds.Checked || ChkSearchInData.Checked)) // Category 2 { invalidControls &= ~ValidatingControls.GrpLookAt; // Clear bit } else { invalidControls |= ValidatingControls.GrpLookAt; // Set bit } }