10390 : How I can find a timeitem by uservariantreference ?


How I can find a timeitem by uservariantreference ?


You will need to iterate thru the Gantt chart like this in c#:

 for(int i=0;i<axphGantX1.DataList3levGantTimes().Count();i++)
    phGantXControl.IphDataList2lev aList2Lev=axphGantX1.DataList3levGantTimes().get_DataList2Lev(i);
    for(int ii=0;ii<aList2Lev.Count();ii++)
      phGantXControl.IphDataList aList=aList2Lev.get_DataList(ii);
      for(int iii=0;iii<aList.Count();iii++)
        phGantXControl.IphDataEntity_GantTime2 aGantTime=aList.get_Items(iii) as phGantXControl.IphDataEntity_GantTime2;
        if (aGantTime.UserVariantReference==THEONEIMLOOKINGFOR)

Or in VB (the code snippets does not do it the exact same way, this code use the RowList...):
    For i = 0 To phGantX1.RowList.Count - 1  ' loop over all gantt rows
        For ii = 0 To phGantX1.RowList.GantRow(i).DataLists.Count - 1 ' loop over all layers in gantt row
            For iii = 0 To phGantX1.RowList.GantRow(i).DataLists.DataList(ii).Count - 1 'loop over all time items
                Set ti = phGantX1.RowList.GantRow(i).DataLists.DataList(ii).Items(iii)
if ti.UserVariantReference=THEONEIAMLOOKINGFOR then

End if
            Next iii
        Next ii
    Next i


Leave a Reply