Getting ProjectStart in C# always returns null

回答済み Getting ProjectStart in C# always returns null

  • 5 aprilie 2012 17: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

Toate mesajele

  • 6 aprilie 2012 06:23
    Moderator
     
     Răspuns

    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

    • Marcat ca răspuns de Rob Blau 6 aprilie 2012 16:47
    •  
  • 6 aprilie 2012 16: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.Start

    Thanks!

    -r

  • 6 aprilie 2012 20:49
    Moderator
     
     
    Love it when a plan comes together!

    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management