Compartir a través de


How to: Call Methods

Once an object has been created, you can call the methods of that object from anywhere in your application.

To call a method

  • Use this syntax:

                Parent.Object.Method
    
    

The following statements call methods to display a form and set the focus to a text box:

frsFormSet.frmForm1.Show
frsFormSet.frmForm1.txtGetText1.SetFocus

Methods that return values and are used in expressions must end in open and closed parentheses. For example, the following statement sets the caption of a form to the value returned from the user-defined method GetNewCaption:

Form1.Caption = Form1.GetNewCaption( )

Note

Parameters passed to methods must be included in parentheses after the method name; for example, Form1.Show(nStyle) passes nStyle to Form1's Show method code.

See Also

Concepts

Protecting and Hiding Class Members

Overriding Default Property Settings

Working with Classes in Visual FoxPro

Other Resources

Object-Oriented Programming