Compartilhar via


IVsObjectList.DoRename(UInt32, String, UInt32) Method

Definition

Asks the given list item to do the rename operation.

public:
 int DoRename(System::UInt32 index, System::String ^ pszNewName, System::UInt32 grfFlags);
public:
 int DoRename(unsigned int index, Platform::String ^ pszNewName, unsigned int grfFlags);
int DoRename(unsigned int index, std::wstring const & pszNewName, unsigned int grfFlags);
public int DoRename (uint index, string pszNewName, uint grfFlags);
abstract member DoRename : uint32 * string * uint32 -> int
Public Function DoRename (index As UInteger, pszNewName As String, grfFlags As UInteger) As Integer

Parameters

index
UInt32

[in] Specifies the index of the list item of interest.

pszNewName
String

[in] Pointer to a null terminated string containing the new name.

grfFlags
UInt32

[in] Flag indicating that Index is part of a multi-select. Values are taken from the _VSOBJOPFLAGS enumeration.

Returns

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.

Applies to