How to: Call Methods

JavaScript Editor js editor     Web development 



Main Page

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:

    В Copy Code
                  Parent.Object.Method
                

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

В Copy Code
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:

В Copy Code
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



JavaScript Editor js editor     Web development