IncrementalSearch.AppendCharAndSearch(Int16) Method

Definition

Adds a character to the ISearch pattern and performs a search for the new string.

public:
 EnvDTE80::vsIncrementalSearchResult AppendCharAndSearch(short Character);
public:
 EnvDTE80::vsIncrementalSearchResult AppendCharAndSearch(short Character);
EnvDTE80::vsIncrementalSearchResult AppendCharAndSearch(short Character);
[System.Runtime.InteropServices.DispId(7)]
public EnvDTE80.vsIncrementalSearchResult AppendCharAndSearch (short Character);
[<System.Runtime.InteropServices.DispId(7)>]
abstract member AppendCharAndSearch : int16 -> EnvDTE80.vsIncrementalSearchResult
Public Function AppendCharAndSearch (Character As Short) As vsIncrementalSearchResult

Parameters

Character
Int16

A short integer that translates to a Unicode character.

Returns

A vsIncrementalSearchResult enumeration.

Attributes

Examples

Sub testIS()  
    ' Set variables for text pane.  
    Dim tp As EnvDTE80.TextPane2  
    tp = CType(DTE.ActiveDocument.ActiveWindow.Object.ActivePane, _  
    TextPane2)  
    ' Start an incremental search forward from  
    ' the current insertion point in the document.  
    tp.IncrementalSearch.StartForward()  
    ' Add the character "a" to the search pattern.  
    tp.IncrementalSearch.AppendCharAndSearch(Asc("a"))  
    ' Display the status of the search mode.  
    'MsgBox("ISearch status: " & _  
    tp.IncrementalSearch.IncrementalSearchModeOn.ToString)  
    ' Perform incremental search using the pattern ("a").  
    tp.IncrementalSearch.SearchWithLastPattern()  
    ' After the search, exit incremental search mode.  
    tp.IncrementalSearch.Exit()  
End Sub  

Remarks

AppendCharAndSearch adds a new character to the search pattern (see the Pattern property) and then searches for the new pattern in the current direction.

If a match is found, the editor selection moves to the match and the Found value is returned.

If a match is not found, the selection does not change and the Failed value is returned. New characters may not be appended to a failed search pattern. To make further progress with AppendCharAndSearch, the erroneous character must be removed from the pattern.

Use the AscW() function to provide the Unicode code point for the character.

Applies to