Freigeben über


IVsObjectList.DoRename Method

Asks the given list item to do the rename operation.

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

Syntax

'Declaration
Function DoRename ( _
    index As UInteger, _
    pszNewName As String, _
    grfFlags As UInteger _
) As Integer
'Usage
Dim instance As IVsObjectList
Dim index As UInteger
Dim pszNewName As String
Dim grfFlags As UInteger
Dim returnValue As Integer

returnValue = instance.DoRename(index, _
    pszNewName, grfFlags)
int DoRename(
    uint index,
    string pszNewName,
    uint grfFlags
)
int DoRename(
    [InAttribute] unsigned int index, 
    [InAttribute] String^ pszNewName, 
    [InAttribute] unsigned int grfFlags
)
abstract DoRename : 
        index:uint32 * 
        pszNewName:string * 
        grfFlags:uint32 -> int 
function DoRename(
    index : uint, 
    pszNewName : String, 
    grfFlags : uint
) : int

Parameters

  • index
    Type: System.UInt32
    [in] Specifies the index of the list item of interest.
  • pszNewName
    Type: System.String
    [in] Pointer to a null terminated string containing the new name.
  • grfFlags
    Type: System.UInt32
    [in] Flag indicating that Index is part of a multi-select. Values are taken from the _VSOBJOPFLAGS enumeration.

Return Value

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsObjectList::DoRename(
   [in] ULONG Index,
   [in] LPCOLESTR pszNewName,
   [in] VSOBJOPFLAGS grfFlags
);

The environment calls DoRename when the user commits the rename operation. This method will be called only after CanRename has been called with the pszNewName so that you've had a chance to validate the name. If DoRename succeeds, return S_OK, otherwise return an error in hr and set the rich error info to indicate the problem that was encountered.

If multiple items are to be renamed, the environment will set grfFlags to indicate that multiple DoRename calls are being made. The environment also used the grfFlags parameter to indicate the first and last item to be renamed. You can use this, for instance, to create a single undo action for the multiple data items.

.NET Framework Security

See Also

Reference

IVsObjectList Interface

IVsObjectList Members

Microsoft.VisualStudio.Shell.Interop Namespace