[Gambas-user] closing a form

Benoit Minisini gambas at ...2...
Sat Jun 28 23:39:46 CEST 2003


Le Samedi 28 Juin 2003 19:23, Rob a écrit :
> 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
>
>    ThatOtherForm.Delete

You should better do ThatOtherForm.Close

>
> 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
>
>    MyFirstClass.ThatOtherForm.Delete
>
> 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.Clear
> ThatOtherForm.MyTextbox.Insert("Whatever you wanted to say")

Faster is :

  ThatOtherForm.MyTextbox.Text = "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....)
>
> Rob
>

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list