E
exuviae
I am trying to locate task by a text field in project when updating it from a
database. My problem is the filter only works the first time, after that
ActiveSelection.Task will equal null, even if i am applying the same filter
twice. I am using c# and my code looks like this :
if (firstEver)
{
msProjectApp.FilterEdit("TaskOIFilter", true, true, true,
Missing.Value, Missing.Value, "Text19", Missing.Value, "equals", TaskOI,
Missing.Value,false,true);
firstEver = false;
}
else
{
msProjectApp.FilterEdit("TaskOIFilter", true, false,
true,true, Missing.Value, Missing.Value,"Text19","equals", TaskOI,
Missing.Value, false, true);
}
msProjectApp.FilterApply("All Tasks", false, Missing.Value,
Missing.Value);
msProjectApp.SelectAll();
msProjectApp.FilterApply("TaskOIFilter", false, Missing.Value,
Missing.Value);
msProjectApp.SelectAll();
foreach (MSProject.Task task in msProjectApp.ActiveSelection.Tasks)
{
// first time this works, next time through
msProjectApp.ActiveSelection.Tasks=null
}
database. My problem is the filter only works the first time, after that
ActiveSelection.Task will equal null, even if i am applying the same filter
twice. I am using c# and my code looks like this :
if (firstEver)
{
msProjectApp.FilterEdit("TaskOIFilter", true, true, true,
Missing.Value, Missing.Value, "Text19", Missing.Value, "equals", TaskOI,
Missing.Value,false,true);
firstEver = false;
}
else
{
msProjectApp.FilterEdit("TaskOIFilter", true, false,
true,true, Missing.Value, Missing.Value,"Text19","equals", TaskOI,
Missing.Value, false, true);
}
msProjectApp.FilterApply("All Tasks", false, Missing.Value,
Missing.Value);
msProjectApp.SelectAll();
msProjectApp.FilterApply("TaskOIFilter", false, Missing.Value,
Missing.Value);
msProjectApp.SelectAll();
foreach (MSProject.Task task in msProjectApp.ActiveSelection.Tasks)
{
// first time this works, next time through
msProjectApp.ActiveSelection.Tasks=null
}