I am not sure why this is not working for you but guess this may be due to using the TimeRangeChange event. Can you please try if you see the same behavior when using a function like below?
Private Function GetTrcValCnt(TrendRef As Trend, traceNo As Integer) As Integer
TrendRef.CurrentTrace = traceNo
Dim TrcValCnt As Integer
GetTrcValCnt = TrendRef.TraceValuesCount
I believe the functionality that you are trying to add is already build in. Please try a right-click on a Trend when in run mode and select "Show Details and Annotations" from the context menu. Is this similar to what you are trying to implement?
Retrieving data ...