Compartir a través de


Solution4.IsOpen Property

Definition

Gets whether a solution is open.

public:
 property bool IsOpen { bool get(); };
public:
 property bool IsOpen { bool get(); };
[System.Runtime.InteropServices.DispId(36)]
public bool IsOpen { [System.Runtime.InteropServices.DispId(36)] get; }
[<System.Runtime.InteropServices.DispId(36)>]
[<get: System.Runtime.InteropServices.DispId(36)>]
member this.IsOpen : bool
Public ReadOnly Property IsOpen As Boolean

Property Value

true if a solution is open; otherwise, false.

Implements

Attributes

Examples

Sub IsOpenExample(ByVal dte As DTE2)  
    ' Display the IsOpen status of the 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("Solution " & solnName & _  
        " has the following IsOpen state:" & _  
        vbCrLf & vbCrLf & soln.IsOpen.ToString())  
    Catch ex As System.Exception  
        MsgBox(ex.ToString)  
    End Try  
End Sub  
using System.Windows.Forms;  
public void IsOpenExample(DTE2 dte)  
{  
    // Determines if a solution is open.   
    // 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("Solution " + solnName + " IsOpen status is: "  
          + soln.IsOpen.ToString());  
    }  
    catch(SystemException ex)  
    {  
        MessageBox.Show("ERROR: " + ex);  
    }  
}  

Remarks

An open solution does not necessarily have a solution (.sln) file, because it might not have been saved yet.

Applies to