Hi Andre,
If you want to send more than 6 parameters, you must use CallEx method.
This is the sample from Axapta Help File :
Dim Axapta As Object
Dim MyObject As Object
Dim ParameterList As Object
Set Axapta = CreateObject("AxaptaCOMConnector.Axapta")
Set ParameterList = CreateObject("AxaptaCOMConnector.AxaptaParameterList")
Axapta.Logon
' create an Axapta object
Set MyObject = Axapta.CreateObject("MyClass", "new parameter1", 2)
' set up parameter list
ParameterList.Size = 2
ParameterList.Element(1) = "parameter1"
ParameterList.Element(2) = 2
' we can now call methods of "MyObject" using its "CallEx" method
MyObject.Call "MyMethod", ParameterList
Good luck..
Anil Ozay
Software Engineer
Dynamics AX MVP
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Andre Klopper
Sent: Monday, December 04, 2006 9:55 AM
To: [email protected]
Subject: [development-axapta] Parameter to class from VB...
Hi,
I need some help please, I've written an API (class) to be used to write
certain data to table of ours. I created it with about 10 parameters that
can be sent to it. But the problem is that when I call it with more than 6
parameters it gives me invalid number of argument sent.
Here is the VB app that calls the class in Axapta. What is wrong? Am I
limited to only 6 parameters, because then it works. If so how do I read
objects in Axapta?
Private Sub Command1_Click()
Dim JobCard As Object
Dim sString As String
Set JobCard = Axapta.CreateObject("Class")
sString = JobCard.Call("CreateJobCard", "2345", False, "VB Test", "Param", "
Param ", " Param ", " Param ")
Label1.Caption = sString
End Sub
Private Sub Form_Load()
Set Axapta = CreateObject("AxaptaCOMConnector.Axapta2")
Axapta.Logon2 "user", "", "company", "", "SeverName", "Axapta",
"AxaptaConfig"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Axapta.Logoff
End Sub
Regards
Andre
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]