Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is macro substitution available in .net
Message
 
To
10/07/2006 09:45:08
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01134885
Message ID:
01135924
Views:
20
Remember though using Activation like this requires Full Trust. Anything but Full trust (Actually Full or High Truest) will not allow dynamic type loading from disk...

+++ Rick ---

>>Hi All
>>Is macro sustitution available in Visual Basic .NET Like VFP
>>
>>Ex. In vfp we can call a function by putting the function name in the variable.
>>
>>myfunction = "Function007"
>>do &myfunction
>>
>>is such thing possible in .NET
>
>As Cetin mentioned this is not possible but by using Reflection. At first, I thought this was a very difficult thing to handle. But, after having used it at several occasions for various needs, it is not so difficult after all. I was able to achieve all my goals so far, based from VFP upscaled code to .NET, where I had such need. As for this one, try this:
>
>
>        Dim loClass As Type = Nothing
>        Dim loObject As Object = Nothing
>
>        Try
>            loClass = Type.GetType("YourClass")
>            loObject = Activator.CreateInstance(loClass)
>        Catch loError As Exception
>            oApp.ErrorSetup(loError)
>            Return False
>        End Try
>
>        ' Then, from this point, you have a reference to loObject and you can call anything under it
>        ' such as loObject.MyMethod()
>
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform