This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

END USER TIPS & TRICKS - VB Method Tip for Developers

Anonymous - Tuesday, June 14, 2011 12:57 PM:

I'm a new user of Aras and wanted to share a good tip I learned from the devlopers training class.  It's often helpful to be able to call a function from a function in a Visual Basic server method.  This example shows how to accomplish this. 

Note that the line  ‘MethodTemplateName=VBMain must be provided as a comment at the top of the program and the starting function must be called Main as shown below.

This example shows how to use a simple adder function from another function:
 
 
'Must have following line in code (note:leave commented out)
' MethodTemplateName=VBMain;
 
'Function call from Main function
Function myAdder(x As Integer, y As Integer) As Integer
     Return x + y
End Function
 
 
'Must have function named Main
Function Main() As Item
     Dim sum As Integer
     sum = myAdder(2, 2)
          
     Return Me.getInnovator().newResult(sum)
End Function