IncrementalSearch.AppendCharAndSearch, méthode

Ajoute un caractère au modèle ISearch et exécute une recherche de la nouvelle chaîne.

Espace de noms :  EnvDTE80
Assembly :  EnvDTE80 (dans EnvDTE80.dll)

Syntaxe

'Déclaration
Function AppendCharAndSearch ( _
    Character As Short _
) As vsIncrementalSearchResult
vsIncrementalSearchResult AppendCharAndSearch(
    short Character
)
vsIncrementalSearchResult AppendCharAndSearch(
    short Character
)
abstract AppendCharAndSearch : 
        Character:int16 -> vsIncrementalSearchResult 
function AppendCharAndSearch(
    Character : short
) : vsIncrementalSearchResult

Paramètres

  • Character
    Type : System.Int16
    Entier court qui est converti en un caractère Unicode.

Valeur de retour

Type : EnvDTE80.vsIncrementalSearchResult
Énumération vsIncrementalSearchResult.

Notes

AppendCharAndSearch ajoute un nouveau caractère au modèle de recherche (consultez la propriété Pattern), puis recherche le nouveau modèle dans la direction actuelle.

Si une correspondance est trouvée, la sélection de l'éditeur se place sur la correspondance et la valeur Found est retournée.

Si aucune correspondance n'est trouvée, la sélection ne change pas et la valeur Failed est retournée. Les nouveaux caractères ne peuvent pas être ajoutés à un modèle de recherche en échec. Pour faire de nouveaux progrès avec AppendCharAndSearch, le caractère erroné doit être supprimé du motif.

Utilisez la fonction AscW() pour fournir le point de code Unicode pour le caractère.

Exemples

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

Sécurité .NET Framework

Voir aussi

Référence

IncrementalSearch Interface

EnvDTE80, espace de noms

Autres ressources

How to: Automate an Incremental Search

Comment : rechercher dans un document par incrément