.NETGURU
StringToObject
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.

Post a new message to this list...

Albert
Imagine a project
I've got two dll's referenced, dll1 and dll2

within some function of my project i want to use a function out of dll1/dll2
Normally you then would put in the function:

Function fncSomeProjFunc as int

dim myobj as new dll1 (Make the functions of dll1 available inside this
function)
dim myobj2 as new dll2

dim sResult as string
dim sResult2 as string

sResult = myobj.SomeFunctionwithsResultAsReturnValue
sResult2 = myobj2.SomeFunctionwithsResultAsReturnValue

return 1
end function

Now what i want is this

Function fncSomeProjFunc(byval sDllToCall as String) as int
..
...
....
.....

end function

sDllToCall is either "dll1" or "dll2" being the NAME of the object that I
have to declare.
How can I use sDllToCall to declare an object?

If you for example look at it the other way around,

dim myobj as new dll1

msgbox (myobj.toString) would give "dll1"
so maybe there is some function like myobj=sdlltocall.StringToObject or
something like this?

Posted this question elsewhere too, but no one seems to be able to help me
out here.

Thanks for the help

Reply to this message...
 
    
Jakob Christensen
There are different ways to create an object from the type name. Check out
Activator.CreateInstance or AppDomain.CreateInstance.

HTH, Jakob.

"Albert" wrote:

[Original message clipped]

Reply to this message...
 
    
Albert
Thanks Jakob

"Jakob Christensen" <Click here to reveal e-mail address> schreef in bericht
news:Click here to reveal e-mail address...
> There are different ways to create an object from the type name. Check
out
[Original message clipped]

Reply to this message...
 
 
System.Activator
System.AppDomain




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification