T
Tobias Gansen
Dear group
I'm writing a c# add-in for project 2003
I have a function like the following
private void doSmthWithResource(Project pr, string resName
Resource res = pr.Resources[resName]
It is invoked in two different secenarios
1) Automatically by an event, which then also delivers the project-object in which the resource has to be found. If the resource isn't found, res is null
2) By user request. The user clicks a button in a custom toolbar. The button event handler then goes for the Application.ActiveProject-property and calls the function above. If the resource isn't found, I get a Com-Exception "Wrong arguments"
In both cases the 'FullName' of the project-object is what it should be (the name of the project as it is in the filesystem). I've no idea if this is "a reliable bug": Do what ever has to be done if res is null or an exception occured. May be there are other cases that produce a com-exception, and then the function should not be executed
A similar, yet totally different thing happens with the calendar
private void doSmthWithBaseCals(Project pr
Calendars cals = myProject.BaseCalendars
foreach(Calendar cal in cals
{ //doSmth
Scenarios as above
1.) Automatically invoked by event (ProjectNew): The project-object has NO basecalendars
2.) Invoked by users (only seconds after 1.): The project has basecalendars
Again, 'FullName' in both cases is what it should be - the complete file name
Any ideas
TIA
Tobias
I'm writing a c# add-in for project 2003
I have a function like the following
private void doSmthWithResource(Project pr, string resName
Resource res = pr.Resources[resName]
It is invoked in two different secenarios
1) Automatically by an event, which then also delivers the project-object in which the resource has to be found. If the resource isn't found, res is null
2) By user request. The user clicks a button in a custom toolbar. The button event handler then goes for the Application.ActiveProject-property and calls the function above. If the resource isn't found, I get a Com-Exception "Wrong arguments"
In both cases the 'FullName' of the project-object is what it should be (the name of the project as it is in the filesystem). I've no idea if this is "a reliable bug": Do what ever has to be done if res is null or an exception occured. May be there are other cases that produce a com-exception, and then the function should not be executed
A similar, yet totally different thing happens with the calendar
private void doSmthWithBaseCals(Project pr
Calendars cals = myProject.BaseCalendars
foreach(Calendar cal in cals
{ //doSmth
Scenarios as above
1.) Automatically invoked by event (ProjectNew): The project-object has NO basecalendars
2.) Invoked by users (only seconds after 1.): The project has basecalendars
Again, 'FullName' in both cases is what it should be - the complete file name
Any ideas
TIA
Tobias