Bookshelf Home | Contents | Index | PDF |
Siebel VB Language Reference > VB Language Reference > Call StatementThis standard VB function transfers control to a subprogram or function. Syntax ACall subprogram_name [(argument_list)] Syntax Bsubprogram_name is the name of the subprogram or function to which control is to be passed. ReturnsIf a function, its output; if a subprogram, not applicable. UsageUse the Call statement to call a subprogram or function written in Basic or to call C procedures in a DLL. These C procedures must be described in a Declare statement or be implicit in the application. Make sure the DLL is present on every Siebel Server. If a procedure accepts named arguments, you can use the names to specify the argument and its value. Order is not important. For example, if a procedure is defined as follows: Sub mysub(aa, bb, optional cc, optional dd) The following calls to this procedure are equivalent to each other: call mysub(1, 2, , 4) The syntax for named arguments is as follows: where argname is the name for the argument as supplied in the Sub or Function statement and argvalue is the value to assign to the argument when you call it. The advantage to using named arguments is that you do not have to remember the order specified in the procedure's original definition, and if the procedure takes optional arguments, you do not need to include commas (,) for arguments that you leave out. The procedures that can use named arguments include:
Arguments are passed by reference to procedures written in Basic. If you pass a variable to a procedure that modifies its corresponding formal argument, and you do not want to have your variable modified (that is, if you need to retain the "before" value), enclose the variable in parentheses in the Call statement. This tells Siebel VB to pass a copy of the variable. (This is called passing by value.) Note, however, that generally passing by value is less efficient, and should not be done unless necessary. When a variable is passed to a procedure that expects its argument by reference, the variable must match the exact type of the formal argument of the function. (This restriction does not apply to expressions or variants.) When calling an external DLL procedure, arguments can be passed by value rather than by reference. This is specified in the Declare statement, the Call statement itself, or both, using the ByVal keyword. If ByVal is specified in the declaration, then the ByVal keyword is optional in the call. If present, it must precede the value. If ByVal was not specified in the declaration, it is illegal in the call unless the data type was unspecified in the declaration. ExampleThis example calls a subprogram named (general) (declarations) Sub CreateFile Sub Button1_Click See Also |
Siebel VB Language Reference |