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

Steven Drinnan steven at ...1545...
Tue Mar 4 10:40:04 CET 2008


If i need to do that I create a public sub to set the text box or use
properties to set the field value

EG. 

Public sub setTextBox1(nText as string)

	TextBox1.text = ntext

end


On Mon, 2008-03-03 at 19:06 +0000, Richard wrote:
> 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
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________ Gambas-user mailing list Gambas-user at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list