Method not found in the Com Object

  • Thread starter Thread starter Ramesh
  • Start date Start date
R

Ramesh

hi,
I have created one Component using C#. it have once
class name is BusinessObject. In this class i have one
method "CreatedRecords". When i make the build it created
ComponentName.dll file in the obj\Debug and bi\Debug
directory.
Then i have executed gacutil /i ComponentName.dll
It displayed message saying that Cache successfully added.

In my Web application I have selected this dll reference.
(i tried both obj\debug\Compnentname.dll and
bin\Debug\Componentname.dll)

when i create the instance i have used following statment.
CompnentName.BusinessObject myTest = new
CompnentName.BusinessObject();

But when i try to access CreateRecords method by using
following statment
myTest.CreateRecords();
it is not able to list the method name. In the component
services also CreateRecords method not listed. I have
created this method using "Public" key word in Component.
So it should list this method name when i use instance of
this object. Can any body knows about this problem.?

-Ramesh

Thanks
Ramesh
 
Hi Ramesh,

I have written a demo for you. You may have try and let me know the result.

[Client]
using System;
namespace ConsoleApplication6
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
ClassLibrary3.Class1 o = new ClassLibrary3.Class1();
Console.WriteLine(o.testMethod(10));
}
}
}

[Component]
using System;
namespace ClassLibrary3
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class Class1
{
public int testMethod(int nCount)
{
return nCount*nCount;
}
}
}


Did I misunderstand your meaning?
Please feel free to let me know if you have related question.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
 
Back
Top