/// <summary> /// Make sure the search text is valid for the type of IMatcher that is created. /// Use the new IsValid method on the IMatcher interface to make sure it's valid /// and allow it to continue, otherwise show the errormessage associated with the /// error and don't allow it to be selected. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void m_okButton_Click(object sender, System.EventArgs e) { IMatcher testMatcher = ResultingMatcher; if (testMatcher.IsValid()) { DialogResult = System.Windows.Forms.DialogResult.OK; return; } string errMsg = String.Format(XMLViewsStrings.ksFilterErrorMsg, testMatcher.ErrorMessage()); MessageBox.Show(this, errMsg, XMLViewsStrings.ksFilterError, MessageBoxButtons.OK, MessageBoxIcon.Error); // If the matcher can make the search text valid - let it if (testMatcher.CanMakeValid()) this.m_textBox.Tss = testMatcher.MakeValid(); }