RAFARIVE
asked on
Translate dll vb.net code to VFP 9
Hi Experts.
I have a vb.net routine to access a credit card processing DLL. I Need to convert that code to use it in a Vfp9 Application.
Vb.Net code is :
----------------------
-------------------------- -----
Please let me know how to do it.
Thanks,
RAFARIVE
I have a vb.net routine to access a credit card processing DLL. I Need to convert that code to use it in a Vfp9 Application.
Vb.Net code is :
----------------------
Dim creditCard As New CredCardConnect.CreditCardClass
creditCard.TransType = CredCardConnect.CreditCardTransTypeEnum.Sale
creditCard.CardNum = "4012000033330026"
creditCard.ExpDate = "0115"
creditCard.MagData = "4012000033330026=15121011000023456789"
creditCard.NameOnCard = "TESTCARD"
creditCard.Amount = 1.07
creditCard.PNRef = ""
creditCard.ExtData = "<RegisterNum>1</RegisterNum><CustomerID>12634</CustomerID>"
Dim rt As CredCardConnect.Gateway.Response = creditCard.Process(txtUsername.Text.Trim, txtPassword.Text.Trim, nudDown.Value, True)
If Not IsNothing(rt) Then
If rt.Result = 0 Then
txtPNRef.Text = rt.PNRef
MessageBox.Show("Approved")
Else
MessageBox.Show(rt.Message)
End If
Else
MessageBox.Show("Error")
END If
--------------------------
Please let me know how to do it.
Thanks,
RAFARIVE
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
A COM wrapper for your .Net assembly should make it consumable to your VFP application.
My Solution is regarding Com Wrapper. please check my solution. it will solve your problem.
As you tagged your question with DECLARE: It's not possible to use VFP DECLARE to declare an entry point to a class, neither an OLE class nor an assembly class. DECLARE can only declare a function declaration, it's return type and parameter types.
You can indeed also use OLE classes via CREATEOBJECT(), even without any previous declaration, but that's less common for assemblies, even after regasm you don't have the same access to assembly classes as to OLE classes.
So either try the interop option recommended by Kalpesh or write your own wrapper, there is no direct use option.
Bye, Olaf.
Edit 04/30: Still no time for this?
To test, what you can see and use from VFP directly you could create an instance of CredCardConnect.CreditCard Class via CREATEOBJECT("CredCardConn ect.Credit CardClass" ) or see, if you can find this class listed for your choice, when adding an olecontrol to a form.
Then inspect what you have and can use with intellisense.
You can indeed also use OLE classes via CREATEOBJECT(), even without any previous declaration, but that's less common for assemblies, even after regasm you don't have the same access to assembly classes as to OLE classes.
So either try the interop option recommended by Kalpesh or write your own wrapper, there is no direct use option.
Bye, Olaf.
Edit 04/30: Still no time for this?
To test, what you can see and use from VFP directly you could create an instance of CredCardConnect.CreditCard
Then inspect what you have and can use with intellisense.
ASKER
Hi!
I tried your suggestions but did not solved yet.
I tried your suggestions but did not solved yet.
We might help further, if you share your findings. It's OK, if you still try things, I just remind you EE does start a closing procedure for threads inactive over three weeks (I think).
So thanks for at least returning, this'll keep this up for another while.
Bye, Olaf.
So thanks for at least returning, this'll keep this up for another while.
Bye, Olaf.
ASKER
Hi,
I still trying. Not resolved yet..
I still trying. Not resolved yet..
We're standing by to help, so what are you trying and what results do you get?
If CREATEOBJECT("CredCardConn ect.Credit CardClass" ) causes an error "class definition ... is not found", then your only chance is writing a wrapper in C# or VB.NET.
Bye, Olaf.
If CREATEOBJECT("CredCardConn
Bye, Olaf.
ASKER
Thanks for your solution.