AllExperts > Experts 
Search      

VB.NET

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More VB.NET Answers
Question Library

Ask a question about VB.NET
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Syed Rizwan Muhammad Rizvi
Expertise
I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.

Experience
Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.

 
   

You are here:  Experts > Computing/Technology > Basic > VB.NET > Project referencing

Topic: VB.NET



Expert: Syed Rizwan Muhammad Rizvi
Date: 4/24/2007
Subject: Project referencing

Question
Hi,

I have an Visual Studio 2005 application written in Visual Basic that I want to connect with to a COM-DLL, if it is registered on the users machine. If not, some functionality of the application will simply not be available. Is there any way to do this and still reference the DLL from Visual Studio, or do I have to declare all references to the DLL as Object and then use CreateObject to instansiate the objects?

Regards,

/Johan

Answer
The easiest way to do it is to leave the references while you are doing development and debugging on your development machine. And just before deployment you can remove the references of from your project. And replace the variable declarators like following:

Original:
Dim objCOM as New ActiveXClass
Dim objCOM2 as ActiveXClass2

Change To:
Dim objCOM as object 'as New ActiveXClass
Dim objCOM2 as object 'as New ActiveXClass2

objCom = createobject("ActiveXClass") 'Remember to use full namespace You can also use Getobject if you dont want create a new instance.

if objCOM is nothing then
'Disable functionality
else
'Enable functionality
end if


Hope that helps.


Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.