[Gambas-user] closing a form

Rob sourceforge-raindog2 at ...94...
Sat Jun 28 19:23:26 CEST 2003

On Saturday 28 June 2003 11:53, Nicola Bisetto wrote:
> 1) how can I close a form that hasn't the focus ?

Supposing that you are trying to close it from the class where you opened it, 
and supposing you named it "ThatOtherForm" and made it public, you just go


This assumes that you did

   Public ThatOtherForm As Form

at the top of the class, and not

   Dim ThatOtherForm As Form

in the procedure where you opened it.

If you're trying to close it from a different class, instead of 
ThatOtherForm.Delete it would be


where MyFirstClass is the name of the class where you opened the form.

> 2) how can I change the value of a control placed in a form that hasn't the
> focus?

You need to check the "Form controls are public" checkbox in the Project 
Properties dialog.  Again you need to make sure you have a reference to the 
form you're trying to access (see above), and you would go (for example)

ThatOtherForm.MyTextbox.Insert("Whatever you wanted to say")

(Maybe it'd be better if there were a SetText method for textboxes that did 
both of those lines, since it's much more common to want to erase what was 
already there than to insert text....)


More information about the User mailing list