<div dir="auto">We lose this ability but won the one of inline declaration <div dir="auto"><br></div><div dir="auto">For each hControl as Control in MyForm.Children </div><div dir="auto"><br></div><div dir="auto">Next </div></div><br><div class="gmail_quote"><div dir="ltr">Le dim. 13 janv. 2019 21:38, Benoît Minisini <<a href="mailto:g4mba5@gmail.com">g4mba5@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Le 13/01/2019 à 15:45, Gianluigi a écrit :<br>
> Before the new changes in the declaration of local variables, it was <br>
> possible, even if I do not understand the reason, to declare a global <br>
> variable to use it in this way:<br>
> <br>
> Private hControl As Control<br>
> <br>
> Public Sub Form_Open()<br>
> <br>
>    For Each hControl In Me.Controls<br>
>      Print hControl.Name<br>
>    Next<br>
> <br>
> End<br>
> <br>
> Now this code is no longer possible.<br>
> <br>
> Regards<br>
> Gianluigi<br>
> <br>
<br>
A loop variable must be local, because of the interpreter and the JIT <br>
compiler. It was possible to use any variable with FOR EACH, but that <br>
was a mistake.<br>
<br>
-- <br>
Benoît Minisini<br>
<br>
----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
</blockquote></div>