更新 : 2007 年 11 月
ISearch パターンに文字を追加し、新しい文字列の検索を実行します。
名前空間 : EnvDTE80
アセンブリ : EnvDTE80 (EnvDTE80.dll 内)
構文
'宣言
Function AppendCharAndSearch ( _
Character As Short _
) As vsIncrementalSearchResult
'使用
Dim instance As IncrementalSearch
Dim Character As Short
Dim returnValue As vsIncrementalSearchResult
returnValue = instance.AppendCharAndSearch(Character)
vsIncrementalSearchResult AppendCharAndSearch(
short Character
)
vsIncrementalSearchResult AppendCharAndSearch(
short Character
)
function AppendCharAndSearch(
Character : short
) : vsIncrementalSearchResult
パラメータ
Character
型 : System.Int16Unicode 文字に変換する短整数です。
戻り値
型 : EnvDTE80.vsIncrementalSearchResult
vsIncrementalSearchResult 列挙体。
解説
AppendCharAndSearch は、新しい文字を検索パターンに追加し (Pattern プロパティのトピックを参照)、現在の方向で新しいパターンを検索します。
一致が見つかった場合、エディタの選択範囲が一致した項目に移動し、Found 値が返されます。
一致が見つからなかった場合、選択範囲は変更されず、Failed 値が返されます。失敗した検索パターンには、新しい文字を追加できない場合があります。AppendCharAndSearch を使用してさらに処理を進めるには、適切ではない文字をパターンから削除する必要があります。
文字に Unicode コード ポイントを指定するには、AscW() 関数を使用します。
例
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
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。