2010/4/13 Jussi Lahtinen <jussi.lahti...@gmail.com>: >> Just in case: >> >> REPEAT >> b = TabStrip3.Count ' In fact, this does nothing usefull >> INC a >> UNTIL a < TabStrip3.Count OR TabStrip3[a].Caption = IdCaption > > This doesn't make same functionality.
That is why I did not want to follow the example anymore. This function never had has any functionality, due to their errors. Neither, your version of the function, because it returns TabStrip3.Count which is the amount of tabs containing the control, ie always return the same value. > Because if ldCaption doesn't match to any of tabstrip captions, > function will still answer TabStrip3.Count instead of zero. > In short, you cannot remove IF THEN construct. Put it out of loop. The correct code: ------------------------ 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 > I think I have done enough errors for this day (I'm going to sleep). Sweet dreams (my childs are going to sleep right now, too). -- Fabián Flores Vadell www.speedbooksargentina.blogspot.com ------------------------------------------------------------------------------ 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