Using COM Objects from VB (Object Picker Dialog) 
Author Message
 Using COM Objects from VB (Object Picker Dialog)

Hi

I want to use the object picker dialog from VB.Net to populate a textbox
with a group name. I've never used COM objects before and am having
difficulty working out exactly what I need to do.

I found an article on MSDN, rather encouragingly called "Referencing COM
Objects from Visual Basic .NET" , but found it very unclear and lacking
in detail. I know that I have to import a type library and use the
CoCreateInstance function, but I don't know how to find out where the
type library is or how to use the function properly.

Please help!

Julia

*** Sent via Developersdex http://www.*-*-*.com/ ***
Don't just participate in USENET...get rewarded for it!



Fri, 26 Nov 2004 17:30:44 GMT  
 Using COM Objects from VB (Object Picker Dialog)
You're working harder than you need to :)  Com interop from within the
VS.Net environment can be pretty automatic.  If you create a project
reference, choose a com .dll, it will automatically create a COM+ wrapper
that allows you to use the COM object within your project.

To do this:
1.  In the VS.Net IDE right click on the project in the solution explorer
2.  Select "Add reference"
3. Click on the tab labeled "COM"
4.  Scroll down to the COM object you need to use, select it, click o.k.

Now you'll be able to use your .dll throughout the project ;)

Please note:  this adds a reference to the wrapped COM object and you'll
need to use fully qualified name.

For some more information, try the link at

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn...
vaconCOMInteroperability.asp

It has an intro topic, some walkthrough samples.

Chris Innes , Chitra Yalamanchili  - Visual Basic QA

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> Hi

> I want to use the object picker dialog from VB.Net to populate a textbox
> with a group name. I've never used COM objects before and am having
> difficulty working out exactly what I need to do.

> I found an article on MSDN, rather encouragingly called "Referencing COM
> Objects from Visual Basic .NET" , but found it very unclear and lacking
> in detail. I know that I have to import a type library and use the
> CoCreateInstance function, but I don't know how to find out where the
> type library is or how to use the function properly.

> Please help!

> Julia

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Sun, 28 Nov 2004 04:00:01 GMT  
 Using COM Objects from VB (Object Picker Dialog)
I'm not sure I understand your question.  Is the "object picker dialog" a
component you created?  Have you tried just adding a COM reference to the
project through the Add Reference dialog (right-click the References node in
the solution explorer)?  This will generate an interop wrapper around the
COM object, and you should be able to call directly into that in your code.

If it is a comonent you want to add to your toolbox, you can do this by
right-clicking the toolbox, selecting "Customize", and browsing to your
component.  The appropriate references and wrapper will be created when you
add an instance to your form.

You can try pasting this link into the Visual Studio .Net help URL:
ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vbconCOMInteropInVisualBasicVisualC.h
tm.  Hope this helps!

Tania Means
VB QA

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> Hi

> I want to use the object picker dialog from VB.Net to populate a textbox
> with a group name. I've never used COM objects before and am having
> difficulty working out exactly what I need to do.

> I found an article on MSDN, rather encouragingly called "Referencing COM
> Objects from Visual Basic .NET" , but found it very unclear and lacking
> in detail. I know that I have to import a type library and use the
> CoCreateInstance function, but I don't know how to find out where the
> type library is or how to use the function properly.

> Please help!

> Julia

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Sun, 28 Nov 2004 04:40:19 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Using the 'Object Picker Dialog Box'

2. Call VB DLL or COM object from within VB COM object or EXE

3. com object will not read registry when com object called from asp (vb works fine)

4. Object Picker Dialog

5. COM-Object in ASP with COM-Object as parameter

6. COM-Object in ASP with COM-Object as Parameter

7. Access a COM object of a COM object?

8. Accessing a COM object of a COM object

9. COM Object-Out of stack space on executing/shell exe from com object

10. Returning an object with sub objects from vb component (COM) to ASP

11. Problem with using Com object from VB.NET

12. accessing word document through vb.net using word com object

 

 
Powered by phpBB® Forum Software