Close All Saved Windows in the IDE

 < Free Open Study > 



Reload a Component

Many times you will make changes to a component and then, before you save the changes, determine that you would like to reload the component from its original state in order to cancel the changes. It may be that the changes are too numerous or complex, in the case of a form, and you just want to restore the module, class, or form without having to unload and reload the project. The following macro command will do that for you. Make sure the component that you want to reload is the active window. When the window prompts you to save the changes, click the No button.

    Sub ReloadComponent()        Dim projs As System.Array        Dim proj As Project        Dim sln As String = DTE.Solution.Item(1).Name        Dim pn As String        Dim s As String        Dim s2 As String = DTE.ActiveDocument.FullName        Dim awn As String = DTE.ActiveDocument.Name        projs = DTE.ActiveSolutionProjects()        proj = CType(projs.GetValue(0), EnvDTE.Project)        pn = proj.Name        s = sln & "\" & pn & "\" & awn        DTE.Windows.Item(Constants.            vsWindowKindSolutionExplorer).Activate()        DTE.ActiveWindow.Object.GetItem(s)           .Select(vsUISelectionType.             vsUISelectionTypeSelect)        DTE.ExecuteCommand("Project.ExcludeFromProjaect")        System.Windows.Forms.Application.DoEvents()        DTE.Windows.Item(Constants.             vsWindowKindSolutionExplorer).Activate()        System.Windows.Forms.Application.DoEvents()        DTE.ItemOperations.AddExistingItem(s2)        DTE.Windows.Item(Constants.             vsWindowKindSolutionExplorer).Activate()        DTE.ActiveWindow.Object.GetItem(s).            Select(vsUISelectionType.            vsUISelectionTypeSelect)        DTE.ActiveWindow.Object.DoDefaultAction()    End Sub



 < Free Open Study > 



Writing Add-Ins for Visual Studio  .NET
Writing Add-Ins for Visual Studio .NET
ISBN: 1590590260
EAN: 2147483647
Year: 2002
Pages: 172
Authors: Les Smith

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net