Object Question

  • Thread starter Thread starter Albert
  • Start date Start date
A

Albert

following problem
in the project i have a reference to 2 dll's which each have a function e.g.
dll_one with function tst_one
dll_two with function tst_two

now in my main app i have to following sub

Start_obj(byval sName as string)

I want to use either tst_one or tst_two, depending on sName which is either
"dll_one" or "dll_two"

normally I would use it as follows:

dim oFunc as new object

oFunc=dll_one.dll_one(or two)

oFunc.tst_one (or two)

How do i define oFunc using sName?
 
Hi,

You could use a delegate, if both functions have the same signature, just
create a new delegate with that signature and then an instance of that
delegate to be used to call the function
then depending of the value you assign the correct function to the delegate
instance and all you have to do is call it.

Cheers,
 
Back
Top