Question
We are evaluating your phGantTimePackage and we have a doubt: we want to delete a link made between 2 tasks. We’ve used the addLink method, but we have a problem when we try to delete the link. We saw a code example in your web and tried to follow it, but we encountered a problem with the types that the method GetLinks returns.
The code line is: “If ((Not alink.LinkOwner Is Nothing) And (Not alink.LinkedTo Is Nothing)) Then” and the error is: ‘the object doesn’t admit this method’.
The complete code is:
Dim alink As IphDataEntity_Link
For i = 0 To theGant.GetLinks.Count() – 1
Set alink = theGant.GetLinks.Items(i)
If Not alink Is Nothing Then
If ((Not alink.LinkOwner Is Nothing) And (Not alink.LinkedTo Is Nothing)) Then
If (alink.LinkOwner = SomeObject of type ‘phGantXControl.IphDataEntity_GantTime’) Or (alink.LinkedTo = = SomeObject of type ‘phGantXControl.IphDataEntity_GantTime’) Then
End If
…
What is wrong? Is there any method similar to addLink for delete a link?
Answer
When you have the link object you can delete it like this:
theGant.GetLinks.Remove(alink);
or theGant.GetLinks.Delete(i);