I
Imran Koradia
You can still use CallByName in VB.NET. Any reason why you wouldn't want to
use that? What you would need is to create an instance of the object from
the class name. Use Activator.CreateInstance to create an instance of the
object. Also, you'll need to use the Type.GetType method to get the type of
the object from the class name. Note that you will have to provide the fully
qualified class name - including namespace and assembly name if the class is
in another assembly. Look up the documentation for Type.GetType to get it to
work correctly in your case. If the class is the same one as the executing
assembly, you can do this for your class (say TestClass which is within
namespace TestNameSpace):
Dim ty As Type = Type.GetType("TestNameSpace.TestClass")
Dim obj As Object = Activator.CreateInstance(ty)
CallByName(obj, "TagValue", CallType.Set, "Tag Value is Set")
Dim Tag As String = _
CStr(CallByName(obj, "TagValue", CallType.Get))
Dim Return As Int16 = _
CallByName(obj, "Find", CallType.Method, _
1, "Tag Name", myDataTable)
hope that helps..
Imran.
use that? What you would need is to create an instance of the object from
the class name. Use Activator.CreateInstance to create an instance of the
object. Also, you'll need to use the Type.GetType method to get the type of
the object from the class name. Note that you will have to provide the fully
qualified class name - including namespace and assembly name if the class is
in another assembly. Look up the documentation for Type.GetType to get it to
work correctly in your case. If the class is the same one as the executing
assembly, you can do this for your class (say TestClass which is within
namespace TestNameSpace):
Dim ty As Type = Type.GetType("TestNameSpace.TestClass")
Dim obj As Object = Activator.CreateInstance(ty)
CallByName(obj, "TagValue", CallType.Set, "Tag Value is Set")
Dim Tag As String = _
CStr(CallByName(obj, "TagValue", CallType.Get))
Dim Return As Int16 = _
CallByName(obj, "Find", CallType.Method, _
1, "Tag Name", myDataTable)
hope that helps..
Imran.