Solved

call a method from a variable name

Posted on 2009-06-30
1
278 Views
Last Modified: 2012-05-07
Is it possible to call a method using a variable name?

varname="Function1"
varname()

varname = "Function2"
varname()
0
Comment
Question by:Delta7428
1 Comment
 
LVL 13

Accepted Solution

by:
crazyman earned 500 total points
ID: 24745918
No it isnt, however using reflection you can.

eg

this.GetType().GetMethod("AMethodName").Invoke(this);

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Different Delete Messages 7 37
Close word object 13 38
How to deploy to IIS 7 on 2008R2 server with DUO 2-step login? 2 30
Runtime Error 2 27
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now