Partager via


IVsFindTarget.Replace Method

Requests a text string replace.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)

Syntax

'Declaration
Function Replace ( _
    pszSearch As String, _
    pszReplace As String, _
    grfOptions As UInteger, _
    fResetStartPoint As Integer, _
    pHelper As IVsFindHelper, _
    <OutAttribute> ByRef pfReplaced As Integer _
) As Integer
int Replace(
    string pszSearch,
    string pszReplace,
    uint grfOptions,
    int fResetStartPoint,
    IVsFindHelper pHelper,
    out int pfReplaced
)
int Replace(
    [InAttribute] String^ pszSearch, 
    [InAttribute] String^ pszReplace, 
    [InAttribute] unsigned int grfOptions, 
    [InAttribute] int fResetStartPoint, 
    [InAttribute] IVsFindHelper^ pHelper, 
    [OutAttribute] int% pfReplaced
)
abstract Replace : 
        pszSearch:string * 
        pszReplace:string * 
        grfOptions:uint32 * 
        fResetStartPoint:int * 
        pHelper:IVsFindHelper * 
        pfReplaced:int byref -> int
function Replace(
    pszSearch : String, 
    pszReplace : String, 
    grfOptions : uint, 
    fResetStartPoint : int, 
    pHelper : IVsFindHelper, 
    pfReplaced : int
) : int

Parameters

  • pszSearch
    Type: System.String

    [in] Pointer to a null terminated string containing the search text.

  • pszReplace
    Type: System.String

    [in] Pointer to a null terminated string containing the replacement text.

  • fResetStartPoint
    Type: System.Int32

    [in] Flag to reset the search start point.

  • pfReplaced
    Type: System.Int32%

    [out, retval] true if the replacement was successful.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

Implement either GetSearchImage method or Find and Replace methods.

COM Signature

From textmgr.idl:

HRESULT IVsFindTarget::Replace(
   [in] LPCOLESTR pszSearch,
   [in] LPCOLESTR pszReplace,
   [in] VSFINDOPTIONS grfOptions,
   [in] BOOL fResetStartPoint,
   [in] IVsFindHelper * pHelper
);

Find is called prior to Replace. When Replace is called, you should verify that the current selection string is equal to pszSearch, then replace the selection with pszReplace.

.NET Framework Security

See Also

Reference

IVsFindTarget Interface

Microsoft.VisualStudio.TextManager.Interop Namespace