I want to pass a list of int from C# to a dll written in vb6 . In vb6 the prototype of function is as follows :
Public Function FamIdentify(agentList As Collection, strName As String, strIdentifyTemplate As String, strIP As String) As Boolean
From C# I am calling this function As follows :
public Boolean IdentifyFinger(String name, String SampleModel, String REMOTE_ADDR)
{
List<int> agentList = new List<int>();
// insert some element to this list
FamServer.FamApp famApp = new FamServer.FamApp();
Boolean flag = famApp.FamIdentify(ref agentList, ref name, SampleModel, REMOTE_ADDR);
return flag ;
}
For this coding I am facing this error
cannot convert from system.collections.generic.list to string to Vba.collections
How can I pass list from C# to vb6 ? Please help me .
You need to create Microsoft.VisualBasic.Collection
, add values from List
, and only then pass it to function. I think, there is no direct cast to Collection
.
Microsoft.VisualBasic.Collection agentCollection= new Microsoft.VisualBasic.Collection();
agentList.ForEach(x=> agentCollection.Add(x));
Boolean flag = famApp.FamIdentify(ref agentCollection, ref name, SampleModel, REMOTE_ADDR);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With