VCFile.Move(Object) Method

Definition

Moves a file or folder into the top level of the project or a new folder.

public:
 void Move(System::Object ^ Parent);
public:
 void Move(Platform::Object ^ Parent);
void Move(winrt::Windows::Foundation::IInspectable const & Parent);
[System.Runtime.InteropServices.DispId(408)]
public void Move (object Parent);
[<System.Runtime.InteropServices.DispId(408)>]
abstract member Move : obj -> unit
Public Sub Move (Parent As Object)

Parameters

Parent
Object

Required. The project or folder into which you want to move the file or folder. This parent must be in the same project as the current file or folder being moved.

Attributes

Examples

The following example uses Move in the integrated development environment (IDE):

' add reference to Microsoft.VisualStudio.VCProjectEngine  
Imports EnvDTE  
Imports Microsoft.VisualStudio.VCProjectEngine  

Public Module Module1  
    Sub Test()  
        Dim prj As VCProject  
        Dim MyCol As IVCCollection  
        Dim file As VCFile  
        Dim folder As VCFilter  
        prj = DTE.Solution.Projects.Item(1).Object  
        MyCol = prj.Filters  
        folder = MyCol.Item("MyFolder")  
        MyCol = prj.Files  
        file = MyCol.Item("MyFile.txt")  
        file.Move(folder)  
    End Sub  
End Module  

Remarks

The file or folder that will be moved is the object on which you are calling Move. The destination of the move is the parameter passed to Move. See How to: Compile Example Code for Project Model Extensibility for information about how to compile and run this example.

Applies to