473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

creating COM objects

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
Nov 20 '05 #1
3 1052
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" <dh*****@ivsi.com> wrote in message
news:O8**************@TK2MSFTNGP11.phx.gbl...
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

Nov 20 '05 #2
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" <dh*****@ivsi.com> wrote in message
news:O8**************@TK2MSFTNGP11.phx.gbl...
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

Nov 20 '05 #3
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" <th**********@ntlworld.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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" <dh*****@ivsi.com> wrote in message
news:O8**************@TK2MSFTNGP11.phx.gbl...
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


Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: vande | last post by:
Hi, I am trying to create com objects in asp.net. The objects are getting created but the context in the object created is null. If I create the same object in asp the object is ok and the...
8
by: Nanda | last post by:
hi, I am trying to generate parameters for the updatecommand at runtime. this.oleDbDeleteCommand1.CommandText=cmdtext; this.oleDbDeleteCommand1.Connection =this.oleDbConnection1;...
2
by: JJ L. | last post by:
Hello. I have a project that consists of nine different objects, each serving their own purpose. In the past I have just created a form for each one, and then whenever you call, say,...
5
by: Chris | last post by:
Hi, to create an array of 2 objects (e.g. of type '__gc class Airplane') I need to do : Airplane * arrAirplanes __gc = new Airplane* __gc; arrAirplanes = new Airplane("N12344"); arrAirplanes...
3
by: Ken Varn | last post by:
I am just starting the process of creating ASP.NET server controls. I have created controls for .NET applications, but have just started with ASP.NET. I am a little confused about some areas that...
5
by: | last post by:
Trying to learn about manipulating collections of objects, and populating these objects dynamically from datasources. Could someone post a code sample that shows the following: Instantiating a...
1
by: chris | last post by:
I know I've asked this before, but I didn't really get an answer and I bet it's because I didn't explain myself very well. Here goes again. I have this code: Dim arrData(intNoOfRows,...
5
by: fireball | last post by:
please help newbie I need to create a lot of objects the same type (let's say: schemas) I wish to use paramerized block in loop to do so. - how to put names of my objects to such control-flow? ...
31
by: JoeC | last post by:
I have read books and have ideas on how to create objects. I often create my own projects and programs. They end up getting pretty complex and long. I often use objects in my programs they are...
13
by: jkimbler | last post by:
As part of our QA of hardware and firmware for the company I work for, we need to automate some testing of devices and firmware. Since not everybody here knows C#, I'm looking to create a new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.