method ExShellObject.InvokeRename ()
Renames a shell object at runtime.

TypeDescription
Call the InvokeRename method to call renaming an folder or a file, at run-time. Use the Get(SelectedItems) method to retrieve the selected objects in the current view. The rename operation starts only if the selected shell object supports renaming. For instance, if you try to rename the Recycle Bin folder, it is not allowed, since it doesn't support renaming. The view is focused, when the InvokeRename method is executed. Use the InvokeCommand method to execute a command from the object's context menu.

The following VB sample starts renaming the selected object, when the user presses the F2 key:

Private Sub ExShellView1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF2 Then
        ExShellView1.Objects.Get (SelectedItems)
        With ExShellView1.Objects
            If (.Count > 0) Then
                .Item(0).InvokeRename
            End If
        End With
    End If
End Sub