Access a com component

B

Brad Coble

I have an ASP.NET 2 web page that needs to load a com component and display
the results from a method.

I keep getting the error CS0117: 'object' does not contain a definition for
'DataPoints'

I know that the com object contains this method because I use it other
places.

This is my first try at using com from code behind so I'm not sure I'm doing
this correct.

The code im using is:
int dp = 0;

Object dtu = Server.CreateObject("IGEngine.IGEngine");

dp = dtu.DataPoints("u1").Value;

Label1.Text = dp.ToString();

Thanks!!



Brad
 
R

Richard

If I were you I'd scrap the late binding create a reference to your COM
object in references and code as follows.

int dp = 0;

IGEngine.IGEngine dtu = new IGEngine.IGEngine;

dp = dtu.DataPoints("u1").Value;

Label1.Text = dp.ToString();

There is absolutely no reason why this should not work assuming you IIS
ASPNET account has permissions to run the IGEngine.IGEngine (Assuming
your not impersonating?).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top