PC Review


Reply
Thread Tools Rate Thread

Convert String to Functionname?

 
 
=?Utf-8?B?am9uaWdy?=
Guest
Posts: n/a
 
      5th Feb 2007
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
 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      5th Feb 2007
"jonigr" <(E-Mail Removed)> schrieb:
> 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/>

 
Reply With Quote
 
=?Utf-8?B?am9uaWdy?=
Guest
Posts: n/a
 
      6th Feb 2007
Got it working. Thanks Herfried.

-Joni

"Herfried K. Wagner [MVP]" wrote:

> Check out 'CallByName'.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert 'System.Collections.ObjectModel.ReadOnlyCollection(Of String)' to '1-dimensional array of String'. roidy Microsoft VB .NET 12 17th Jul 2009 10:53 AM
Get class- and functionname sewid Microsoft C# .NET 7 28th Jan 2008 03:06 PM
the name 'functionname' does not exist in the current context weird0 Microsoft C# .NET 2 28th Mar 2007 03:05 AM
Convert Dictionary<string,SomeType> keys to List<string> buzzweetman@gmail.com Microsoft C# .NET 6 9th Aug 2006 03:54 PM
Connection String object Convert to String Variable Type =?Utf-8?B?TWlrZSBNb29yZQ==?= Microsoft ASP .NET 2 26th Oct 2004 03:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:16 AM.