Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

RE: FN-FORUM: .NET calling unknown functions from code

date posted 17th January 2005 21:49

Andy,

As far as I know because .net is inherently strongly typed, you can't call
functions in that way. The only way I know of is to use the
System.Reflection namespace to examine a target object and use one of the
Invoke methods to call it's methods dynamically. I've found one article
that may be of use:

http://builder.com.com/5100-6373_14-1050654.html

HTH

Danny

-----Original Message-----
From: [EMAIL REMOVED] [EMAIL REMOVED] On Behalf Of Andy
Macnaughton-Jones
Sent: 17 January 2005 20:16
To: FN-FORUM / [EMAIL REMOVED]
Subject: FN-FORUM: .NET calling unknown functions from code


Hi,
I'm trying to build some code whereby the generates ASP.NET pages will
control the code / functions that are called.

Because the pages are generated by xslt, I don't want to limit the
functions that may or may not be called.

I can't remember how in VB.NET to call a function by a soft-coded name.

E.g.


Dim X as string

X = fnMyFunction("123")



Is fine

But how do I do;

Dim X as string
Dim Y as string

Y = "fnMyFunction"

X = Y("123")

If that makes sense.

Otherwise I'm going to have to hard code all of the functions that I may
or may not call. This is for some shared code and I don't want to have
to limit what I'm doing at this point.

The other option I had was to create an standard interface and create
objects that way, but using createobject("object.class") doesn't work
for me in .NET, so I'm a bit buggered.

Suggestions on a plate please ;-)

Cheers
Andy
and freelance jobs




Messages by Day
January 31st 2005
January 30th 2005
January 29th 2005
January 28th 2005
January 27th 2005
January 26th 2005
January 25th 2005
January 24th 2005
January 23rd 2005
January 22nd 2005
January 21st 2005
January 20th 2005
January 19th 2005
January 18th 2005
January 17th 2005
January 16th 2005
January 15th 2005
January 14th 2005
January 13th 2005
January 12th 2005
January 11th 2005
January 10th 2005
January 9th 2005
January 8th 2005
January 7th 2005
January 6th 2005
January 5th 2005
January 4th 2005
January 3rd 2005
January 2nd 2005
January 1st 2005


Messages by Month
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000