Passing an Array from C# to VB.Net

I need help converting a C# app to a C# dll.  I don't know C#, and I'm writing an app in vb.net, I need to be able to declare a public function in the C# dll.  I have a sample solution written in C# that gets EXIF data from images.  I need to be able to call it from a VB.Net app.  I'm using VS 2005.
I have created the dll, but the function that gets the data is not available in the vb app.
Here is some of the code.

public System.Collections.ArrayList GetExifTags(ImageXTagCollection a2)
{
System.Collections.ArrayList myArrayList = new ArrayList();
//Code to get ExifData
return myArrayList;
}

When I look at the object browser in the vb app, I can see the function, and it is public.  Why can I not use it?
Thanks


Jimmy LeaAsked:
Who is Participating?
 
dunglaCommented:
Did you add reference to C# dll from VB app?

Here is my sample class do the same thing:

=== C# DLL===
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace myDLL
{
    public class Utils
    {
        public ArrayList GetTags(int count)
        {
            ArrayList myArr = new ArrayList(count);
            for (int i = 0; i < count; i++)
                myArr.Add(i + 1);
            return myArr;
        }
    }
}

=== VB App===
Imports System.Collections
Public Class myForm

    Private Sub btnClick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClick.Click
        Dim myUtils As New myDLL.Utils()
        Dim myArr As ArrayList
        myArr = myUtils.GetTags(5)
        For i As Integer = 0 To myArr.Count - 1
            MessageBox.Show(myArr(i))
        Next
    End Sub
End Class
0
 
Jimmy LeaAuthor Commented:
That's it.
I missed 'Dim myUtils As New myDLL.Utils()'

Thanks



0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.