PC Review


Reply
Thread Tools Rate Thread

creating COM objects

 
 
Dan Holmes
Guest
Posts: n/a
 
      6th Oct 2003
I am creating an aspx application to use our existing COM objects. I
referenced the component correctly and i have it Dimmed correctly. What i
get is "InvalidCastException". Here is the code

Dim cfg as CIBOMConfig.IB_BOMConfig
Dim o as Object
o = CreateObject("CBOMConfig.IB_BOMConfig")
cfg = o ' error happens here.

CIBOMConfig.IB_BOMConfig is not the default interface for this component.
It is one of the implement statements. I can't figure out how to get the
..NET eqivalent of QueryInterface to work. in VB6 the assignment would do
it.

Dan Holmes


 
Reply With Quote
 
 
 
 
Dan Holmes
Guest
Posts: n/a
 
      6th Oct 2003
I don't know if it matters but the implements statement in the VB6 component
is from a type library i created. I didn't reference the dll but the tlb.

Dan Holmes

"Dan Holmes" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I am creating an aspx application to use our existing COM objects. I
> referenced the component correctly and i have it Dimmed correctly. What i
> get is "InvalidCastException". Here is the code
>
> Dim cfg as CIBOMConfig.IB_BOMConfig
> Dim o as Object
> o = CreateObject("CBOMConfig.IB_BOMConfig")
> cfg = o ' error happens here.
>
> CIBOMConfig.IB_BOMConfig is not the default interface for this component.
> It is one of the implement statements. I can't figure out how to get the
> .NET eqivalent of QueryInterface to work. in VB6 the assignment would do
> it.
>
> Dan Holmes
>
>



 
Reply With Quote
 
Tom Spink
Guest
Posts: n/a
 
      6th Oct 2003
Hi Dan, try this:

Dim cfg As New CIBOMConfig.IB_BOMConfig

and then just use 'cfg' as you would

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations


"Dan Holmes" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I am creating an aspx application to use our existing COM objects. I
> referenced the component correctly and i have it Dimmed correctly. What i
> get is "InvalidCastException". Here is the code
>
> Dim cfg as CIBOMConfig.IB_BOMConfig
> Dim o as Object
> o = CreateObject("CBOMConfig.IB_BOMConfig")
> cfg = o ' error happens here.
>
> CIBOMConfig.IB_BOMConfig is not the default interface for this component.
> It is one of the implement statements. I can't figure out how to get the
> .NET eqivalent of QueryInterface to work. in VB6 the assignment would do
> it.
>
> Dan Holmes
>
>



 
Reply With Quote
 
Dan Holmes
Guest
Posts: n/a
 
      7th Oct 2003
VB won't let me do that. the CIBOMConfig.IB_BOMConfig is underlined green.
Intellisense didn't prompt for that either. It is just an interface though.

Dan Holmes

"Tom Spink" <(E-Mail Removed)> wrote in message
news:%23Wh$(E-Mail Removed)...
> Hi Dan, try this:
>
> Dim cfg As New CIBOMConfig.IB_BOMConfig
>
> and then just use 'cfg' as you would
>
> --
> HTH,
> -- Tom Spink, Über Geek
>
> Please respond to the newsgroup,
> so all can benefit
>
> " System.Reflection Master "
>
> ==== Converting to 2002 ====
> Remove inline declarations
>
>
> "Dan Holmes" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I am creating an aspx application to use our existing COM objects. I
> > referenced the component correctly and i have it Dimmed correctly. What

i
> > get is "InvalidCastException". Here is the code
> >
> > Dim cfg as CIBOMConfig.IB_BOMConfig
> > Dim o as Object
> > o = CreateObject("CBOMConfig.IB_BOMConfig")
> > cfg = o ' error happens here.
> >
> > CIBOMConfig.IB_BOMConfig is not the default interface for this

component.
> > It is one of the implement statements. I can't figure out how to get

the
> > .NET eqivalent of QueryInterface to work. in VB6 the assignment would

do
> > it.
> >
> > Dan Holmes
> >
> >

>
>



 
Reply With Quote
 
Tom Spink
Guest
Posts: n/a
 
      7th Oct 2003
Hi Dan,

If it's an interface, then you can't create an instance of it... You can
create an instance of a class that implements that interface however.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations


"Dan Holmes" <(E-Mail Removed)> wrote in message
news:#ODv8$(E-Mail Removed)...
> VB won't let me do that. the CIBOMConfig.IB_BOMConfig is underlined green.
> Intellisense didn't prompt for that either. It is just an interface

though.
>
> Dan Holmes
>
> "Tom Spink" <(E-Mail Removed)> wrote in message
> news:%23Wh$(E-Mail Removed)...
> > Hi Dan, try this:
> >
> > Dim cfg As New CIBOMConfig.IB_BOMConfig
> >
> > and then just use 'cfg' as you would
> >
> > --
> > HTH,
> > -- Tom Spink, Über Geek
> >
> > Please respond to the newsgroup,
> > so all can benefit
> >
> > " System.Reflection Master "
> >
> > ==== Converting to 2002 ====
> > Remove inline declarations
> >
> >
> > "Dan Holmes" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I am creating an aspx application to use our existing COM objects. I
> > > referenced the component correctly and i have it Dimmed correctly.

What
> i
> > > get is "InvalidCastException". Here is the code
> > >
> > > Dim cfg as CIBOMConfig.IB_BOMConfig
> > > Dim o as Object
> > > o = CreateObject("CBOMConfig.IB_BOMConfig")
> > > cfg = o ' error happens here.
> > >
> > > CIBOMConfig.IB_BOMConfig is not the default interface for this

> component.
> > > It is one of the implement statements. I can't figure out how to get

> the
> > > .NET eqivalent of QueryInterface to work. in VB6 the assignment would

> do
> > > it.
> > >
> > > Dan Holmes
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating COM objects in C# Dan Holmes Microsoft C# .NET 1 30th Jan 2008 06:15 PM
Creating COM Objects or Add-Ins from VBA =?Utf-8?B?SmltUldS?= Microsoft Excel Programming 1 31st Oct 2007 10:09 PM
Re: Creating COM objects Willy Denoyette [MVP] Microsoft C# .NET 0 6th Jul 2004 10:38 AM
Re: Creating COM objects Mark Broadbent Microsoft C# .NET 0 4th Jul 2004 02:37 PM
Creating objects Simonc Microsoft Access Getting Started 1 20th Nov 2003 12:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:58 AM.