hi,

> I do not check this at all:
>
> Public Sub Page_First_Init()
>      Dim hPictureBox As PictureBox
>      Dim I As Integer
>      For i = 0 To 9
>          hPictureBox = New PictureBox(Me) As "PBX"
>          hPictureBox.Tag = i
>      Next
> End

ok, you have a loop from 0 to 9 in which you create PictureBoxes by 
using New, each of them gets the event name "PBX" and a tag to identify 
them.
those PictureBoxes are created on Me and therefore now normal controls. 
you additionally hold a reference to the just created one in hPictureBox 
so you can change its attributes as you want:
hPictureBox.Visible = False
you can pick a particular box using Me.Children (i don't know, if this 
is the best solution for it):

Public Function Pick(iInd As Integer) As PictureBox
   Dim cControl As Control

   For Each cControl In Me.Children
     If Object.Type(cControl) = "PictureBox" And cControl.Tag = iInd Then
       Return cControl
     Endif
   Next
   Return Null
End

the thing with this is that Tags may be set arbitrarily, so checking if 
the control is also a PictureBox is a little more secure not to give 
something wrong back but keep in mind that for some reason, you may have 
given another PictureBox the same Tag which leads to giving back the 
first one recognized in Me.Children... (according to the doc, the Tag 
property of Controls aren't used by any component but only by the 
programmer, so you might take this solution with care or derive another 
one from it.
for a different approach, you may have a look at the ArrayOfControls 
example.

within an event raised by the PBX "group" you can just use Last.

i hope, it's somehow clearer, now?

regards,
tobi

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to