Click to See Complete Forum and Search --> : Adding or chanching a reference in the code


isabelle
February 15th, 2000, 09:19 AM
Is it possible to change a reference in the code?

Someone can help me with that???

Isabelle

isabelle
February 15th, 2000, 09:24 AM
Oups!!!

Sorry, it's changing!!!

Chris Eastwood
February 15th, 2000, 09:50 AM
Referenes are 'hard-coded' at compile time to take advantage of COM early binding. What is it you are trying to do ?

If you know the interface that a component supports, you can use late binding (with a *lot* of error handling) to manage external components, eg:


Dim o as Object
'
on error Goto WhereEver
'
set o = CreateObject("SomeThirdPartyProgram.AClassModule")
'
Call o.DoSomethingYouKnowAbout (somevalue, andanothervalue)
'
set o = nothing
'




Of course, if you know the interface that the external component supports (say it's a third-party DLL that uses an Interface from your code) :



Dim o as IMyOwnInterface
'
' Where 'AClassModule' Implements IMyOwnInterface
'
set o = CreateObject("SomeThirdPartyProgram.AClassModule")
'
o.YourInterfaceMethod
'
set o = nothing
'





Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb