[Gambas-user] How to transport array values from Form1 to Form2 ?

fabien gambasfr at ...11...
Sun Jun 26 22:17:18 CEST 2005


Le Dimanche 26 Juin 2005 21:47, rospolosco a écrit :
> Hi,  Gambas users.
>
> This is the problem. In Form1 I create 56 checkboxes with this code:
>
> 'Gambas class file
>
> MyCheckBox[14,4] AS CheckBox
>
> PUBLIC SUB Form_Open()
>
>  ...
>
>   prX = 340
>   prY = 102
>
>
>   FOR n = 0 TO 13
>       FOR m = 0 TO 3
>
>          MyCheckBox[n,m] = NEW CheckBox(ME) AS "checkboxes"
>          MyCheckBox[n,m].X = prX
>          MyCheckBox[n,m].Y = prY
>          prX = prX + 40
>
>       NEXT
>       prX = 340
>       prY = prY + 40
>   NEXT
>
> ...
>
> END
>
> Then I open the second form, Form2. In Form2 I need to
> know if the checkboxes I've created in Form1 are checked or not.
> I mean I need something like:
>
>   FOR n = 0 TO 13
>        FOR m = 0 TO 3
>              PRINT MyCheckBox[n,m].value
>        NEXT
>    NEXT
>
> Currently I store the values of checkboxes in a file and then I read it
> from form2, but I would like to know if there's a more clean
> way to read the values of Form1 checkboxes from Form2.
>
> Note: I've read the docs of Gambas and I'm able to transport
> single variables from a form to another, but I'm not able to transport
> an entire array of checkboxes. Please, someone could help me?
>
> Thanks,
>
> Stefano
>
>
>
this is the answer :

in the project option dialog ... check the 'Form controls are public' check 
box.

Next from the form do:

WITH Form1
   FOR n = 0 TO 13
        FOR m = 0 TO 3
              PRINT .MyCheckBox[n,m].value
        NEXT
    NEXT
END WITH






More information about the User mailing list