On Jul 16, 2007, at 9:56 AM, Bill Witherspoon wrote:

> I assumed that I would be able to access one form from another by  
> going
> through it's application property, something like:
>
> self.Application.MyOtherFormName.txtBox.Value = "the value I want  
> to pass"

        The attribute you are looking for is self.Appllication.uiForms.  
However, it does not resolve items by name as you are trying to do.

        Normally forms are distinct and do not reference each other, but  
there are exceptions. When that behavior is needed, you need to  
supply a reference to the 'target' form so that it can refer to that  
form's methods/properties as needed.

> The dApp docs make mention that it contains a collection of  
> applications
> forms, but I can't seem to find it in the properties.
>
> I did get the behavior I was after by using:
> self.Parent.txtBox.Value = "the value"
>
> but I wasn't sure if this was the best way.

        That will only work if the form in question is a child form of the  
one containing the text control. It will not work in most cases.
        
        Also, it is generally considered inadvisable to tightly bind the  
name and position of a control on a form to anything. This is  
considered "tight coupling", and now even minor changes to one form  
can break the other. The better approach would be to add a method to  
the form containing the textbox that will return the desired value,  
and have the other form call that method. This way, the calling form  
doesn't need to 'know' anything about the internal structure of the  
other form.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to