次の方法で共有


Solution4.Close(Boolean) Method

Definition

Closes the current solution.

void Close(bool SaveFirst = true);
[System.Runtime.InteropServices.DispId(18)]
public void Close (bool SaveFirst = true);
[<System.Runtime.InteropServices.DispId(18)>]
abstract member Close : bool -> unit
Public Sub Close (Optional SaveFirst As Boolean = true)

Parameters

SaveFirst
Boolean

Optional. Indicates whether to save the solution before closing it; true if the solution should be saved prior to closing it, false if not.

Implements

Attributes

Examples

Sub SolnCloseExample(ByVal dte As DTE2)  
    ' Close a solution.  
    ' Make sure you have a solution open 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("Closing the solution " & solnName)  
        soln.Close()  
    Catch ex As System.Exception  
        MsgBox(ex.ToString)  
    End Try  
End Sub  
using System.Windows.Forms;  
public void SolnCloseExample(DTE2 dte)  
{  
    // Close 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("Closing the solution " + solnName);  
        soln.Close(true);  
    }  
    catch(SystemException ex)  
    {  
        MessageBox.Show("ERROR: " + ex);  
    }  
}  

Applies to