[Gambas-user] How to reference control on another form

Richard richard.j.walker at ...247...
Mon Mar 3 20:06:00 CET 2008


On Sunday 02 March 2008 11:27:44 richard terry wrote:
> I would have thought this was easy, however for the life of me I cannot get
> it to work. This simple concept has bought my main project to a grinding
> halt!
>
> I attach a picture and code, of something absolutely basic which I tried to
> get this concept to work - embed a form in a workspace, then when the
> button is clicked, change the text in the textbox.
>
> 1) form created (form1) with a textbox (textbox1) only
> 2) main form created with a workspace (workspace1)
> 	the form1 is added to the workspace on Fmain, and a button put underneath
> ===========================
> Code for Fmain:
>
> PUBLIC newform AS form1
>
> PUBLIC SUB Form_Open()
>  newform = NEW Form1
>  newform.title = "Tab 1"
>
>  Workspace1.Add(newform)
>
> END
>
> PUBLIC SUB Button1_Click()
> 'this dosn't work
>   newform.textbox1.text = "hullo"
>
> END
> ============================
>
> Any help appreciated.
>
> Richard

Hi Rich, don't know if there is a "nicer" way, but try setting form controls 
as publicly visible in your project. It worked for me. See pics


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Project10-properties.jpg
Type: image/jpeg
Size: 37419 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20080303/d0941e6f/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Project10-success.jpg
Type: image/jpeg
Size: 8089 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20080303/d0941e6f/attachment-0001.jpg>


More information about the User mailing list