COM Interop

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Harrington

    #1

    COM Interop

    Please forgive me, I'm sure this is an easy question for most people. I am
    attempting to write a class library in C# that can also be called from
    traditional application.... here is my code:

    using System;

    namespace CWrapTest
    {
    public class Class1
    {
    public string Reverse(string reverse)
    {
    string sReverse = "";

    for (int i=reverse.Lengt h - 1; i > -1; i--)
    {
    sReverse += reverse.Substri ng(i, 1);
    }

    return sReverse;
    }
    }
    }

    In VisualStudio.NE T under the project's properties I set the value "Register
    for COM Interop" to True, compiled the project, went into a copy of VB6,
    included a reference CWrapTest type library. It displays that Class1 is
    available, but the function Reverse isn't there.

    Can someone tell me what I need to do, or what I'm doing wrong?

    Thanks in Advanced,

    Mike


Working...