Errata corrige: >> >> >>> Finally, your last lines of code do not work: >>> >>> >> Yes, it works. >> >> >> >>>> PRIVATE FUNCTION ScanTab(IdCaption AS String) AS Byte >>>> DIM a AS Byte = 0 >>>> >>>> WHILE (a< TabStrip1.Count - 1) AND (TabStrip1[a].Text<> >>>> IdCaption) >>>> INC a >>>> WEND >>>> >>>> RETURN IF(TabStrip1[a].Caption = IdCaption, a, -1) >>>> END >>>> >>>> >> >> >>> The third cycle does not get executed - "a" is 2, which is not less than >>> "3-1" (it is equal). >>> >>> >> That's irrelevant because the external comprobation (the logical >> expression in the return sentence) >> >> > May be that I am missing something, but... how can you say that it works > if it omits to test the last item? > Time later, driving to home and still thinking about this routine, I finally recalled what you wanted to say with "comprobation". Yes, you are right - your code works. If I would have payed more attention to the routine, I would have noticed. But, stupidly, I concentrated only on the cycle, noting that it was missing a test on the last item. That last item is managed by the last test before exiting.
Still I don't like this routine. What happens if TabStrip1.Count=0 (emtpy tabstrip)? Ok, now I'am home, it's late - so good night to everybody (in Europe, of course). Regards, -- Doriano Blengino "Listen twice before you speak. This is why we have two ears, but only one mouth." ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user