473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Convert String to Functionname?

I'm learning VB.NET on the fly and manual and web fail me on this one.

Say I have three Functions

TheColor(arg1)
ItsBlack(arg2)
ItsWhite(arg2)

How do I turn the output of TheColor, which is either the string "Black" or
"White", into a functionname? Something like

"Its" & TheColor(arg1)(arg2)

won't work for obvious reasons, but illustrates the point.

I guess I could find a way using If...Then but actually I have more "Colors"
and additional features (ItsBlackMetal, ItsWhiteStone etc.) and it would be
neat if I could "compose" the functionname directly from the strings.

Someway to convert a string to a functionname perhaps?

Any help appreciated. Thanks!

-Joni
Feb 5 '07 #1
2 1291
"jonigr" <jo****@discussions.microsoft.comschrieb:
I'm learning VB.NET on the fly and manual and web fail me on this one.

Say I have three Functions

TheColor(arg1)
ItsBlack(arg2)
ItsWhite(arg2)

How do I turn the output of TheColor, which is either the string "Black"
or
"White", into a functionname? Something like

"Its" & TheColor(arg1)(arg2)
Check out 'CallByName'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Feb 5 '07 #2
Got it working. Thanks Herfried.

-Joni

"Herfried K. Wagner [MVP]" wrote:
Check out 'CallByName'.
Feb 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: sean | last post by:
In article <cyH8c.3460$GH3.601@fed1read07>, sean@sands.beach.net (Sean Berry) writes: > I don't know that this partilarily bad programming, > but I was interested in doing the following. > > def...
7
by: Andrzej | last post by:
Is it possible to call a function which name is given by a string? Let assume that I created a program which call some functions for example void f1(void), void f2(void), void f3(void). ...
11
by: Tito | last post by:
Hi all: Is there a metalanguage capability in Python (I know there are many) to call a function having its name in a string? Something like: __call__("foo") instead of: foo()
6
by: Servé Lau | last post by:
suppose I want to use sscanf get the functionname from a function prototype. Is the following format string correct then? char funcname; char *p = "func(void)"; sscanf(p, "%s", funcname);...
1
by: Hugh | last post by:
Hi all, Is it possible to execute a function by getting the name of the function to execute from a string? For example: string FunctionName = "MyFunction"; which would execute MyFunction()....
1
by: jacew | last post by:
Hi Does anyone know if its possible to call a method from it's string reproesentation e.g int CallFN(string FunctionName return ... FunctionName.. So if a method exists called GetAge...
13
by: krbyxtrm | last post by:
hi, i have problem implemting a string parser that parser comman delimited string: "str1,str2,str3" INTO: 1. str1 2. str2 3. str3 *also strings are of any string (no specific string/keyword)
12
by: -Lost | last post by:
What in the world is functionName.name good for? That is: function functionName() { return functionName.name; } I mean, I already had to write out the function's name so it seems that it is...
11
by: dolphin | last post by:
Hi All! I have a question that how to call a function just using a string. For example There is a .cpp file named a.cpp.There are some functions::fun1() fun2() fun3(). I have another fucntion...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.