Question

I have some .Net functionality I am trying to use in VB6. I have followed several tutorials. I wrote a test program with success using the formula here: http://www.codeproject.com/Articles/3511/Exposing-NET-Components-to-COM

However, when I try to do it with my actual project, my ProgId doesn't show in the registry like my test file. I made sure property ComVisible == true

using System.Runtime.InteropServices;

namespace Controls.Graph.Web
{
    [Guid("5F9F6C6F-016A-4CFF-BD7A-3463761807E1")]
    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    public interface _GraphScript
    {
        [DispId(1)]
        string getGraphXml();
    }

[Guid("35901BC6-EFF1-490C-84FA-786E8462C553")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId(ProgIds.GraphScript)]
public class GraphScript : _GraphScript
{
    protected GraphScript()     
    {
    }

    /// <summary>
    /// 
    /// </summary>
    /// <returns>The graphs xml and javascript</returns>
    public string getGraphXml()
    {
        DisplayDefaults tempDefaults;
        tempDefaults = new DisplayDefaults();

        GraphConstructor graph = new GraphConstructor();
        graph.constructGraph();
        GraphModel completedGraph = graph.Graph;

        return GraphControl.RenderGraph(completedGraph, tempDefaults, 1) + GraphControl.RenderGraphScript();
    }
}
}

and my progid...

using System;

namespace Controls.Graph.Web
{
    /// <summary>
    /// ProgID Constant
    /// </summary>
    public static class ProgIds
    {
        public const string GraphScript = "GraphData";
    }
}

I'm not sure which piece of the puzzle I'm missing here

EDIT: actually the Guid shows up in the registry however the Progid still is not. Any ideas/suggestions?

also made sure to do this: registered for com interop

Was it helpful?

Solution

I have figured out what was wrong. I needed to change some access modifiers to PUBLIC -- including my GraphScript() constructor.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top