>>>Hi Martina,
>>>
>>>What is the "WITH .RETURN.. ENDWITH bug"???
>>
>>IIRC, it's that you should not just jump out of a with/endwith block - so no return, loop or exit statements, because with/endwith seems to stay in effect, having not reached the endwith statement. So the "with stack" (for lack of better term) remains in unresolved, or active, state, is not automatically reset. Don't remember what ill effects it may have, but I do remember that I went through all of my code when it was discovered and checked for this. Found a couple.
>
>Thanks for this info, Dragan.
>
>Our software has a lot of places with such code. I have never noticed any negative effects.
>
>Is there any search-word I can use to find additional info? Does anyone else know more details?
I found this article of Doug:
http://doughennig.blogspot.com/2006/04/dont-return-inside-with.htmlMany years ago I also got those errors from return in With/Endwith, but it is not always reproducable.
Now I follow a rule to have only one exit point in a method (unless the return is just at the beginning based on the situation). Besides the possible errors, it is very difficult to read code if there are multiple exit locations. Best is to have one return variable and evaluate expressions instead of just return inside the method.
Also I find with/endwith overrated, it does not make the code more clear, and also does not really save that much time.
Christian Isberner
Software Consultant