Udostępnij za pośrednictwem


Document.Save Method

Saves the document.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Function Save ( _
    FileName As String _
) As vsSaveStatus
'Usage
Dim instance As Document 
Dim FileName As String 
Dim returnValue As vsSaveStatus 

returnValue = instance.Save(FileName)
vsSaveStatus Save(
    string FileName
)
vsSaveStatus Save(
    [InAttribute] String^ FileName
)
function Save(
    FileName : String
) : vsSaveStatus

Parameters

  • FileName
    Type: System.String

    The name in which to save the document. Defaults to the path associated with this document. That is, if an empty string is passed, the document is saved with its current name.

Return Value

Type: EnvDTE.vsSaveStatus
A vsSaveStatus constant indicating whether or not the save was successful.

Remarks

If FileName cannot be written, such as when the disk is full or there are write permission problems, then Save produces an error. The file is saved with a new name based on FileName.

The FileName parameter is not optional in Visual Studio 2008.

Examples

Sub SaveExample()
    Dim objDoc As Document
    ' Create a new text file.
    DTE.ItemOperations.NewFile("General\Text File")
    ' Create a document reference.
    objDoc = DTE.Documents.Item(1)
    ' Save the new text file.
    objDoc.Save("c:\temp\mynewdoc.txt")
End Sub

.NET Framework Security

See Also

Reference

Document Interface

Document Members

EnvDTE Namespace