System.Windows.Automation.Text.TextPatternRange.FindText C# (CSharp) Method

FindText() public method

public FindText ( string text, bool backward, bool ignoreCase ) : TextPatternRange
text string
backward bool
ignoreCase bool
return TextPatternRange
        public TextPatternRange FindText(string text, bool backward, bool ignoreCase)
        {
            try
            {
                return TextPatternRange.Wrap(
                    this._range.FindText(text, Utility.ConvertToInt(backward), Utility.ConvertToInt(ignoreCase)), this._pattern);
            }
            catch (System.Runtime.InteropServices.COMException e)
            {
                Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; }
            }
        }

Usage Example

Example #1
0
        //---------------------------------------------------------------------------
        // Wrapper for TextPatternRange.FindText Method
        //---------------------------------------------------------------------------
        internal void Range_FindText(TextPatternRange callingRange, ref TextPatternRange targetRange, string text, bool backward, bool ignoreCase, Type expectedException, CheckType checkType)
        {
            string call = "TextPatternRange.FindText(" + text + ", " + backward + ", " + ignoreCase + ")";
            Comment("---Calling " + call);

            if (callingRange == null)
                throw new ArgumentNullException(call + " requires non-NULL TextPatterncallingRange");

            try
            {
                targetRange = callingRange.FindText(text, backward, ignoreCase);
            }
            catch (Exception actualException)
            {
                if (Library.IsCriticalException(actualException))
                    throw;

                TestException(expectedException, actualException, call, checkType);
                return;
            }
            TestNoExceptionQuiet(expectedException, call, checkType);
        }