[Gambas-user] Code issue - dynamic form creation
Bodard Fabien
gambasfr at ...11...
Mon Jan 24 13:38:26 CET 2005
Le lundi 24 Janvier 2005 00:29, Øystein Selbekk a écrit :
> Hi.... Im a Gambas Newbie, and an really old VB dev.
> Im trying the following:
> Dynamic creation of forms like this:
> dim DynNewFrm as new MyFrm
> DynNewFrm.show
> Works Great!
> When my code has done this 2 or 3 times, i would like to write data to say
> form nr 2. This form has a special public ID ex. MyFrm.MyID=5. In VB i do
> like this:
> for i = 0 to forms.count -1
> if forms(i).name = "MyFrm" then
> if forms(i).MyID = 5 then
> forms(i).MyOtherData="This is the one!"
> end if
> end if
> next i
>
> I cant seem to find a forms collection in Gambas.... How do i solve this?
> Anyways: So far Gambas is really impressing! Gooooooood job everyone!
>
> Regards Oystein Selbekk
>
You need to use a collection or an object array
like
Private frmArray as New Object[]
Public sub Generateform()
dim i as integer
dim tmpForm as Form
For i = 0 to 5
tmpform = New MyForm
frmArray.add(tmpForm)
next
end
Public Function GetFormTitle(id as integer) as String
Return frmArray[id].Text
end
Fabien Bodard
More information about the User
mailing list