I created a very simple VSTO addin for Project 2010. It only has 2 buttons - 1 on a Ribbon and another one a custom task pane. Both buttons do the same thing - they filter "Outline Code1" for the value "PD.EE".
Both buttons correctly filter the list of tasks. However, after pressing the button on the task pane, you can't immediately scroll through the tasks with the mouse scroll wheel or the arrow keys. When this happens, you have to click one of tasks first, then you can scroll.
Does anyone know why this happens with a button on a task pane? Here is my code.
Public Class ThisAddIn Private myFilterControl As UserControl1 Private myCustomTaskPane As Microsoft.Office.Tools.CustomTaskPane Public Shared myCustomTaskPaneCollection As Microsoft.Office.Tools.CustomTaskPaneCollection Private Sub ThisAddIn_Startup() Handles Me.Startup myFilterControl = New UserControl1 myCustomTaskPaneCollection = Globals.Factory.CreateCustomTaskPaneCollection _ (Nothing, Nothing, "CustomTaskPanes", "CustomTaskPanes", Me) myCustomTaskPane = myCustomTaskPaneCollection.Add(myFilterControl, "NeuroPMO") With myCustomTaskPane .DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionLeft .Width = 150 .Visible = True End With End Sub Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown myCustomTaskPaneCollection.Dispose() End Sub End Class
Ribbon1.vb
Public Class Ribbon1 Dim app As MSProject.Application Private Sub Ribbon1_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load app = Globals.ThisAddIn.Application End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles Button1.Click app.SetAutoFilter(FieldName:="Outline Code1", FilterType:=MSProject.PjAutoFilterType.pjAutoFilterIn, Criteria1:="PD.EE") End Sub End Class
UserControl1.vb
Public Class UserControl1 Dim app As MSProject.Application Private Sub UserControl1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load app = Globals.ThisAddIn.Application End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click app.SetAutoFilter(FieldName:="Outline Code1", FilterType:=MSProject.PjAutoFilterType.pjAutoFilterIn, Criteria1:="PD.EE") End Sub End Class.
Wellyn