Dim textcom As textcom1.textcom
textcom= CreateObject("textcom1.textcom")

解决方案 »

  1.   

    错误指向:textcom= CreateObject("textcom1.textcom")各位老兄,到是说说如何解决呀,有谁用C#做过COM没,给个方法行不行?
      

  2.   

    到注册表查一下有没有textcom1.textcom。
    如果错误信息是找不到对象的话,有可能是组件没有注册成功。
      

  3.   

    .Net 编的COM,VB里能调用?
      

  4.   

    需要注册C#写的com. 使用.net framework带的实用工具regasm.exe把你的com注册到注册表中,应该没有问题。
      

  5.   

    你按照这个过程试试看,我在我的机器上测试没有问题
    1 现在文件的目录下执行命令:sn -k mykey1.snk生成一个密钥对mykey1.snk
    2 将你原来的代码修改如下
    using System;
    using System.Runtime .InteropServices ;
    using System.Reflection;\\添加
    [assembly: AssemblyKeyFileAttribute("mykey1.snk")]\\添加这一行
    namespace textcom1
    {
    /// <summary>
    /// Summary description for Class1.
    /// </summary>

    [Guid("5F99DD3D-FFC7-4bc3-A4C4-88DEAB431AD1")]
    public interface text_Interface

     string getname(string a );
    }
        [Guid("8BAE3195-03E6-40de-8683-4285AC3F7C03"),InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] 
    public interface text_Events 

    }  [Guid("21D73148-55D4-4a3a-8BD1-2433C0580EF3"),ClassInterface(ClassInterfaceType.None),ComSourceInterfaces(typeof(text_Events))] 
    public class textcom:text_Interface
    {
    public textcom()
    {
    }
    public string getname (string a)
    {
                       return a;
    }
    }}
    3 csc /t:library 你的文件名.cs
    4 gacutil /i 你的文件名.dll
    5 regasm 你的文件名.dll
      

  6.   

    to dy_2000_abc(芝麻开门) (
    你是用VB调吗,怎么我用不可以,错误提示显示:
    Run-time error '91'
    Object variable or with block variable not set我mykey1.dll使用一个regsvr32 命令,得到错误提示:
    C:\mykey1.dll was loaded ,but the Dllregisteserver entry point was not found 希望得到回答。谢谢
      

  7.   

    我是使用VB Script调用的,还有,regsvr32命令不能用于那个类吧,我觉得好像只有继承ServicedComponent类才可以。
      

  8.   

    昨晚喝多了,上面的阐述有误。我觉得在这里你不该使用regsvr32来注册组件,因为你要通过CreateObject创建 COM 对象的服务器实例,这里问题的实质是要com客户访问.net组件,regasm.exe才是将.net组件的类型信息输入注册表的工具。
      

  9.   

    我知道不能用regsvr32注册,
    你能不能用VB调用一下,好象C#对COM的兼容性真是很小,强大的功能是夸出来的
      

  10.   

    奇怪,我在我的机器上调用没有问题:
    Imports System
    Imports Microsoft.VisualBasic.Interaction
    Namespace abc
    Public Class a
    <STAThread()> Shared Sub Main()
    Dim o as new Object
    o=CreateObject("textcom1.textcom")
    Console.WriteLine(o.getname())
    End Sub
    End Class
    End Namespace
      

  11.   

    谢谢,不过不是用VB。NET,是用VB,
    算了,结贴吧,分全给你
    你在工作?做什么?