Compartilhar via


Solution4.Saved Property

Definition

Gets or sets a value indicating whether a solution has not been modified since last being saved or opened.

public:
 property bool Saved { bool get(); void set(bool value); };
public:
 property bool Saved { bool get(); void set(bool value); };
[System.Runtime.InteropServices.DispId(29)]
public bool Saved { [System.Runtime.InteropServices.DispId(29)] get; [System.Runtime.InteropServices.DispId(29)] set; }
[<System.Runtime.InteropServices.DispId(29)>]
[<get: System.Runtime.InteropServices.DispId(29)>]
[<set: System.Runtime.InteropServices.DispId(29)>]
member this.Saved : bool with get, set
Public Property Saved As Boolean

Property Value

true if the object has not been modified since last being saved or opened; otherwise, false. The default is true.

Implements

Attributes

Examples

Sub PropertiesExample(ByVal dte As DTE2)  
    ' Set and get the Saved status of a solution.  
    ' Open a solution in Visual Studio before running this example.  
    Try  
        Dim soln As Solution4 =  _  
        CType(_applicationObject.Solution, Solution4)  
        Dim solnName As String = _  
        System.IO.Path.GetFileNameWithoutExtension(soln.FullName)  
        MsgBox(solnName & " has the following Saved status: "  _  
        & soln.Saved.ToString())  
        MsgBox("Setting the Saved status to False")  
        soln.Saved = False  
            MsgBox(solnName & " now has the following Saved status: " & soln.Saved.ToString())  
    Catch ex As System.Exception  
        MsgBox(ex.ToString)  
    End Try  
End Sub  
using System.Windows.Forms;  
public void ProjectExample(DTE2 dte)  
{  
    // Get and set the Saved status of a solution.   
    // Open a solution in Visual Studio before running this example.  
    try  
    {  
        Solution4 soln = (Solution4)_applicationObject.Solution;  
        string solnName =   
          System.IO.Path.GetFileNameWithoutExtension(soln.FullName);  
        MessageBox.Show(solnName + " has the following Saved status: "  
          + soln.Saved.ToString());  
        MessageBox.Show("Setting the Saved status to false...");  
        soln.Saved = false;  
        MessageBox.Show(solnName +   
          " now has the following Saved status: " +   
          soln.Saved.ToString());  
    }  
    catch(SystemException ex)  
    {  
        MessageBox.Show("ERROR: " + ex);  
    }  
}  

Remarks

The Saved property replaces the IsDirty property in Visual Studio version 6.0, but it returns the opposite value of IsDirty.

Applies to