IncrementalSearch.SearchWithLastPattern 方法
在不更改模式的情况下重复当前的 ISearch
命名空间: EnvDTE80
程序集: EnvDTE80(在 EnvDTE80.dll 中)
语法
声明
Function SearchWithLastPattern As vsIncrementalSearchResult
vsIncrementalSearchResult SearchWithLastPattern()
vsIncrementalSearchResult SearchWithLastPattern()
abstract SearchWithLastPattern : unit -> vsIncrementalSearchResult
function SearchWithLastPattern() : vsIncrementalSearchResult
返回值
类型:EnvDTE80.vsIncrementalSearchResult
vsIncrementalSearchResult 枚举。
备注
SearchWithLastPattern 用于针对上次执行的搜索开始一个新搜索。 如果模式为空或者如果针对该字符串不再有匹配项,则该方法失败。
SearchWithLastPattern 不更改搜索模式。
示例
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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。