MinimizeChanging Focus in Solution Explorer

Now create, save, and run Test_002 :

Sub Test_002()

Dim myprojectname As String

' ***** Title
MyOutput = AddOutputPane("Powerhouse Data Test_002")
Print(MyOutput, " ")
Print(MyOutput, " ***** Powerhouse Data VSM *****")
Print(MyOutput, " ")
Print(MyOutput, " > Beginning at " & Now())

' ***** List all the projects in the solution
' There should only be one project in VS 2005 DNN IDE
DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate()
projs = DTE.ActiveSolutionProjects()
soln = DTE.Solution
proj = projs.GetValue(0)
For Each proj In projs
myprojectname = proj.Name.ToString() ' This is where your Portal resides.
Print(MyOutput, vbNewLine & " > Current Project = " & myprojectname)
Next

' ***** Get the path
Dim prop As [Property]
prop = proj.Properties.Item(14) ' Full Path
ProjectPath = prop.Value.ToString() ' Store Full Path here.
s.Length = 0 'clear the stringbuilder
s.Append(" > Actual ProjectPath = " & ProjectPath & vbNewLine)

' ***** Take a look at all the properties
For Each prop In proj.Properties
s.Append(vbNewLine " > " prop.Name " : " prop.Value.ToString())
Next prop
Print(MyOutput, s.ToString())

' ***** You must move focus if it is not correct.....
DTE.ActiveWindow.Object.GetItem(myprojectname).Select(vsUISelectionType.vsUISelectionTypeSelect)
Print(MyOutput, vbNewLine " > End " & Now())

End Sub

You’ve just learned how to change focus within the Solution Explorer window. Do some testing again to see the consequence. Inside your Solution Explorer window expand the App_Code node. Now give a single-click on AssemblyInfo.vb file. AssemblyInfo.vb is now selected (highlighted). Run the Test_002 again.

screen7.jpg

 

Notice that the selected item has changed focus to be on the very top item. This is your current project. This is more significant than you might guess! Please try to add this knowledge to your “important things” trivia. (oxymoron?)

continued page 6.....

Print  

Thursday, March 11, 2010

Copyright 2008 by Powerhouse Data   *  Terms Of Use  *  Privacy Statement