I'm getting the "No Free Channel available" error message after some time looping through the FOR-NEXT below.
It is very hard to reproduce, some times it does happens sometimes it's just fine.
I'd like to know what causes it???
I thought I can through in a call ChnDel(chnNum) to clean up things but it still crashes with or without it.
Please advise!!!
Thanks,
Boyan
PtlShow = False
View.AutoRefresh = false
DataDelAll
Call View.Sheets.RemoveAll()
Set MySheet = View.Sheets.Add("NewSheet")
call ChnDelete("1-" & ChnNoMax)
chnNum = 1
progresNum = 1
'===================================================================================
Dim l1, l2, n
Dim wholeJob, pRatio()
Dim NewGroup
Call LoopInit()
For i = 0 to ubound(ObjTestDates)
l2 = ubound(ObjTestDates(i).Measurements) + 1
Call MsgLineDisp ("Channel " & i & " of " & ubound(ObjTestDates))
wholeJob = 2 * l2
ReDim Preserve pRatio(i)
pRatio(i) = (100 / wholeJob)
NewGroup = "Group " & CStr(i+1) & " - " & ObjTestDates(i).TestDate
Call GROUPCREATE(NewGroup, i+1)
Call GroupDefaultSet(i+1)
For ii = 0 to ubound(ObjTestDates(i).Measurements)
For n= 0 to 1
if n = 0 then
CurrChannel = CStr(ii+1) & " X_Channel " & " - " & ObjTestDates(i).Measurements(ii)
else
CurrChannel = CStr(ii+1) & " Y_Channel " & " - " & ObjTestDates(i).Measurements(ii)
end if
call ChnDel(chnNum)
Call chnalloc(CurrChannel,ObjTestDates(i).ChannelLength(ii)+1,1,DataTypeFloat64,"Numeric",i+1,chnNum)
Call LoopInc(progresNum*pRatio(i))
chnNum = chnNum + 1
progresNum = progresNum + 1
Next
Next
progresNum = 0
Call LoopInc(progresNum*pRatio(i))
progresNum = 1
Next
Call LoopDeInit()
Call msgboxcancel