Hello all,
Can you please tell me the steps and the syntax for creating a class that I can call from a method? this is similar to this post but I am unable to make what I would expect the equivalent vb code to work.
What I have done so far is to create a new method and enter the following and then press the "check syntax" button, which causes an error.
Public Class Foo()
Function Food() as string
Return "Cheese"
End function
End Class
I am confident in vb.net coding but am getting to grips with developing Methods in Aras and so I may have not understood some concepts.
Any help would be much appreciated.
Thank you for your response AJ, I understand the principle of what you're demonstrating.
So I changed my test program to something slightly more practical as follows (I created a github account to try and replicate your code presentation, but failed to find where I can actually write the code, but that's for another time!) :
dim newPart as item
dim test as new Foo
'newPart = Me.getInnovator.newResult(test.BlankPart)
newPart = test.BlankPart
End Sub
Public Class Foo
Function BlankPart() as item
dim inv as innovator = me.GetInnovator
dim itemToReturn as item = inv.newitem("Part", get)
Return itemToReturn
End Function
End Class
Function helper() as string
Return "test"
It errored when compiled though. (as another aside the error does not show what the issue, but triggers a pop up where it can't find a dll file whose names changes all the time, so apologies with being vague with the error response)
By commenting out the lines to find out where it breaks, if I simply do this:
dim newPart as item '--No problems
end sub '--This causes a problem
So there must be something not set or defined in the application...? or what have I missed?
Are there any thoughts on this?
I have been able to do the equivalent in JavaScript client side, just not able to replicate it vb server side...
Thanks