BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

System.InvalidCastException

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ActiveX Controls Development
View previous topic :: View next topic  
Author Message
JDowner
Guest





PostPosted: Thu Aug 28, 2003 4:22 pm    Post subject: System.InvalidCastException Reply with quote



Using D7 I have written a very simple in-process server COM object (with
Type lib) with one function and no properties that retruns shipment tracking
information. I am able to import the type library into D7 and use it in an
application.

The dll is to be used by a vendor that is writing a new web site for us in
..net. When they try to call the function they receive an error. Any ideas?

Here is their code and the error:

CHPComLib.ChpShipTrackClass chpTracker = new
CHPComLib.ChpShipTrackClass();
string status;
int len;
int result;
result = chpTracker.Track(txtCarrierCode.Text, txtTrackingNumber.Text,
out status, out len);
lblStatus.Text = status;
lblLength.Text = len.ToString();

txtCarrierCode.Text and txtTrackingNumber.Text are just pulling text strings
from a couple of text boxes I set up on a form. I'm getting the following
error when I execute the line that calls chpTracker.Track():

QueryInterface for interface CHPComLib.IChpShipTrack failed.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.InvalidCastException: QueryInterface for interface
CHPComLib.IChpShipTrack failed.





Back to top
JDowner
Guest





PostPosted: Thu Aug 28, 2003 4:26 pm    Post subject: Re: System.InvalidCastException Reply with quote



Additional Info:

They registered my dll and added a reference to it in the ASP.NET web site
project. (When they add the reference, Visual Studio.NET automatically
creates an interop assembly - a .NET component which they can call from
ASP.NET and which calls the underlying COM component for them, handling all
of the marshalling of data, etc.) They then wrote a simple test page to
instantiate a ChpShipTrack object and call the Track() method.




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ActiveX Controls Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.