共用方式為


IVsSimpleObjectList2.DoRename Method

Asks the given list item to do the rename operation.

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

Syntax

'宣告
Function DoRename ( _
    index As UInteger, _
    pszNewName As String, _
    grfFlags As UInteger _
) As Integer
'用途
Dim instance As IVsSimpleObjectList2
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 vsshell80.idl:

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

The environment calls DoRename when the user commits the rename operation. This method is called only after CanRename has been called with the pszNewName so that you have had a chance to validate the name. If DoRename succeeds, return S_OK, otherwise return an error 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

IVsSimpleObjectList2 Interface

IVsSimpleObjectList2 Members

Microsoft.VisualStudio.Shell.Interop Namespace