October 11th, 2010, 08:10 AM
Calling C++/CLI method from C#
I have ported some old BC++ code to Managed C++/CLI code and build it to a dll
Now I trie to call a method from this dll in my C# code. But this does not work. The compiler gives the following error:
'TProjLicense' does not contain a definition for 'CalcSignature' and no extension method 'CalcSignature' accepting a first argument of type 'TProjLicense' could be found (are you missing a using directive or an assembly reference?)
The code (C++/CLI) in my DLL is as follows:
public class TProjLicense
String ^ TProjLicense::CalcSignature(String ^ CustName, array<String ^> ^Proj,
And from C# I am calling it as follows:
// Make a list of all project names
String  ProjectList = new String ;
//ProjectList = cmbProject1->Items->Strings[cmbProject1.SelectedIndex];
ProjectList = cmbProject1.SelectedText;
ProjectList = cmbProject2.SelectedText;
// Generate the signature;
edtSignature.Text = License.CalcSignature(edtCustomerName.Text,
Probably there is something with the string array, but I am new in CLI/C# so I don't have a clue how to solve this.
Has anyone an idea ?
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!