Getting ProjectStart in C# always returns null
-
2012年4月5日 下午 05:05
I'm relatively new to C# and VSTO, so I'm hoping this is an easy question, but I just haven't been able to figure out an answer.
I've got a Project Add-In that is a C# project. I'm trying to base some calculations off of the ProjectStart date (known to be filled out and valid), which seems like it should be an easy thing, but the ProjectStart property of this.Application.ActiveProject always returns null. The odd thing is that if I add a watch to the project and drill down in Visual Studio, I do see that the dynamic property has a Date value and the value is valid. Anybody know how my code can see what the debugger sees?
This is in Project 2010, Visual Studio 2010 Ultimate, Windows 7.
Thanks in advance for the help!
-Rob Blau
所有回覆
-
2012年4月6日 上午 06:23版主
I hope all software has the latest Service Packs? If not you need them.I found a number of small annoying bugs when trying to use C# and VSTO, including some fields not returning the data I expected.
As a work around you can try instead looking at the Start date of Task 0 for that project. This should be the same value.
Rod Gill
The one and only Project VBA Book Rod Gill Project Management- 已標示為解答 Rob Blau 2012年4月6日 下午 04:47
-
2012年4月6日 下午 04:47
Yup, completely up to date on service packs (and updates in general). I smacked my head when I saw the idea about Task 0, wishing that I had thought of it. For the record, this seems to be equivalent and actually works:
Application.ActiveProject.ProjectSummaryTask.StartThanks!
-r
-
2012年4月6日 下午 08:49版主Love it when a plan comes together!
Rod Gill
The one and only Project VBA Book Rod Gill Project Management