[quoted text, click to view] dgm wrote:
> Evert,
>
> I would very much like to know how you were successful in sending the
> initialized arrays. Could you show me a sample .NET method that is
> successfully accepting an array marshalled from VB to .NET?
>
> Dave
>
Hmm,
Did not have a problem with that. I am using VS.NET 2003 EA with all
patches & updates applied.
Created a .NET project with the "Register for COM Interop" option set in
the projects configuration properties. Then applied a keyset to the
assemply in order to get it into the gac.
Coded an interface and implemented it in a class.
That's it.
Sample code:
============================================================================
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace YourNamespace
{
[Guid("40FF80BA-AD50-4c22-A6F7-57DFCB4DF90D")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface _YourInterface
{
/// <summary>
/// StartWork public method.
/// </summary>
/// <param name="StringArray"></param>
/// <param name="SecondStringArray"></param>
/// <param name="FirstString"></param>
/// <param name="SecondString"></param>
/// <param name="FirstUninitializedArray"></param>
/// <param name="SecondUninitializedArray"></param>
/// <returns>Integer</returns>
[DispId(1)]
Int32 StartWork(
string[] StringArray,
string[] SecondStringArray,
string FirstString,
string SecondString,
string[] FirstUninitializedArray,
string[] SecondUninitializedArray);
}
[Guid("57473E2C-FC0A-4ef5-A6D5-96FC834BA142")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("YourCompany.YourComponent")]
public class YourComponent : _YourInterface
{
/// <summary>
/// YourComponent Constructor
/// </summary>
public YourComponent() {}
/// <summary>
/// StartWork public method.
/// </summary>
/// <param name="StringArray"></param>
/// <param name="SecondStringArray"></param>
/// <param name="FirstString"></param>
/// <param name="SecondString"></param>
/// <param name="FirstUninitializedArray"></param>
/// <param name="SecondUninitializedArray"></param>
/// <returns>Integer</returns>
/// <returns>Integer</returns>
public Int32 StartTransfer(
string[] StringArray,
string[] SecondStringArray,
string FirstString,
string SecondString,
string[] FirstUninitializedArray,
string[] SecondUninitializedArray);
{
for(int i=0;i<StringArray.Length;i++)
{
MessageBox.Show(".NET Module for job:" + StringArray[i]);
}
return 1;
}
}