C# timescaledata bug

J

jop

I have created a COM addin for MS Project 2000 in C# and I'm kind of stuck
trying to manipulate timescaled data.(importing planned holidays in to
planning and import actual hours from timeregistration into the planning
system) .Net interop with MS Project 2000 seems to be rather flawed,...
especially when you are trying to use timescalevalues you seem to get rather
frequently COM exceptions...
Once such an error has occurred, it will happen for every subsequent call to
timescalevalues. I have written exactly the same in VB6 and in VBA and this
works so I guess the problem occurs within the interop classes.

My code looks something like this,....

oTSVs =
tskHolidays.Assignments.get_UniqueID(iAssigUniqueId).TimeScaleData(Convert.T
oDateTime(strDate),Convert.ToDateTime(strDate),PjAssignmentTimescaledData.pj
AssignmentTimescaledWork,PjTimescaleUnit.pjTimescaleDays,1);


//block of 1 day

foreach(TimeScaleValue oTSV in oTSVs)

{

//timescalevalues are in minutes

dblNrOfHours = Double.Parse(drRow["NrOfHours"].ToString());

strNrOfHours = dblNrOfHours.ToString();

try

{

if (oTSV.Value.ToString().Length != 0)

{

oTSV.Value = strNrOfHours;

}

//never holidays entered... use add

else

{

oTSVs.Add(strNrOfHours,1);

}

}

catch (Exception e)

{

//create XML error file

MSPAddinNetException ex = new
MSPAddinNetException("#"+projectid.ToString()+"# Error downloading
holidays...At date "+strDate+" - nrhours "+strNrOfHours+" for
"+oRes.Initials+"("+i.ToString()+")",e);

ExceptionManager.Publish(ex);

ActionWithErrors = true;

}

}

}


Has anybody noticed a similar problem. For the moment I have created another
VB6 dll which I will access from my .Net addin but it seems rather weird
that it doesn't work,

friendly greetings,

Poelmans Joris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top