Convert String to Functionname?

G

Guest

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
 
H

Herfried K. Wagner [MVP]

jonigr said:
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'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top