IncrementalSearch.SearchForward 方法

从当前位置到文档的结尾搜索当前模式。

命名空间:  EnvDTE80
程序集:  EnvDTE80(在 EnvDTE80.dll 中)

语法

声明
Function SearchForward As vsIncrementalSearchResult
vsIncrementalSearchResult SearchForward()
vsIncrementalSearchResult SearchForward()
abstract SearchForward : unit -> vsIncrementalSearchResult 
function SearchForward() : vsIncrementalSearchResult

返回值

类型:EnvDTE80.vsIncrementalSearchResult
一个 vsIncrementalSearchResult 枚举。

备注

无论上次是沿着哪个方向搜索,SearchForward 都向前搜索。 它不修改模式。

如果找到了匹配项,则编辑器选定内容将移动到新位置。 如果搜索失败,则选定内容将不移动。

如果搜索模式为空,则 SearchForward 只是设置搜索方向。

示例

Sub testIS2()
    ' Before running, open a document in Visual Studio.
    ' Set variables for text pane.
    Dim tp As EnvDTE80.TextPane2
    tp = CType(DTE.ActiveDocument.ActiveWindow.Object.ActivePane, _
    TextPane2)
    ' Start an incremental search backward from
    ' the current insertion point in the document.
    tp.IncrementalSearch.StartBackward()
    ' Add the character "a" to the search pattern.
    tp.IncrementalSearch.AppendCharAndSearch(Asc("a"))
    ' Display the parent name for IncrementalSearch object.
    MsgBox("IncrementalSearch parent: " & _
    tp.IncrementalSearch.DTE.FullName)
    MsgBox("Search pattern length: " & _
    tp.IncrementalSearch.Pattern.Length)
    ' Perform incremental search using the pattern ("a").
    tp.IncrementalSearch.SearchWithLastPattern()
    ' After the search, exit incremental search mode.
    MsgBox("DeleteCharAndBackup")
    tp.IncrementalSearch.DeleteCharAndBackup()
    MsgBox("SearchForward")
    tp.IncrementalSearch.SearchForward()
    MsgBox("SearchBackward")
    tp.IncrementalSearch.SearchBackward()
    MsgBox("Exit")
    tp.IncrementalSearch.Exit()
End Sub

.NET Framework 安全性

请参见

参考

IncrementalSearch 接口

EnvDTE80 命名空间

其他资源

How to: Automate an Incremental Search

如何:对文档进行渐进式搜索