Late Binding Solution for CF.NET

J

J.R. Brown

Anyone know of a late binding solution for CF.NET, or any ideas how to
implement this? I already know that it is not natively supported in
the CF.NET.

Thanks a bunch for your comments.

J.R.
 
J

J.R. Brown

Maybe this will help...

I am trying to do something like this: I know you can't actually do
the following in CF.NET. I'm looking for a similar dynamic
alternative...

----------------------------------------------------------
Dim myObj As Object
Dim myAssem As System.Reflection.Assembly

myAssem = myAssem.LoadFrom(MyDLLFilePath) '<-- This works.
myObj = myAssem.CreateInstance("MyAssem.Class") '<-- This works.

Dim newMMP As Panel = myObj.Initialize '<-- at myObj.Initialize you
get the error which says that CF.NET does not support late binding.
-----------------------------------------------------------

Again, maybe there is no suitable alternative but its worth a try
investigating since this would give this application the greatest
flexibility.

Thanks Alex, I hope this clarifies.

J.R.
 
A

Alex Feinman [MVP]

I see.
Although there is no late binding, you can use Reflection to invoke methods
dynamically. It's a bit more work, but you can wrap it into a set of
functions/methods and get by:

'Instead of this
'Dim newMMP As Panel = myObj.Initialize
'Do this
Dim newMMP As Panel =
CType(myObj.GetType().GetMethod("Initialize").Invoke(myObj, Nothing), Panel)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top