[Gambas-user] Accessing control in different form

Rob sourceforge-raindog2 at ...94...
Tue Aug 12 04:59:16 CEST 2003


On Monday 11 August 2003 21:56, Rizky Tahara Shita wrote:
> when in VB, the example like that above could be accessed by the following
> code:
> 	Fmain.textbox1.text="xx"

Yeah, while Benoit finally gave in to us recovering VB users and made a 
"public form controls" option, doing what you describe will still generate an 
error because "Fmain" refers to the class, not the instance.

To make a control accessible with that syntax, you'd need to make it static.  
This is easy to do if you create the control in code, but I don't know how to 
make it happen using the form designer.  However, you SHOULD be able to do 
the following, assuming you opened FSecond from FMain:

ME.Parent.textbox1.text = "xx"

See if that works... I had someone else ask me a similar question offline and 
I was stumped, but off the top of my head it seems like this should work....

Rob





More information about the User mailing list