help referencing value of a string variable via another variable

N

name

Tricky

I'm trying to do the following


string sString = "Here is a test string";
string sFieldRef = "sString";
MessageBox.Show(sFieldRef); //How do I get this line to display: Here is a
test string???



I want the messagebox to show what's stored
in sString (Here is a test string) but by
only using sFieldRef.

I know in Clipper, this is referred to as Macro Expansion.
Not sure how to do this in c#

Thanks in Advance,

Chris
 
E

|{evin

Tricky

I'm trying to do the following


string sString = "Here is a test string";
string sFieldRef = "sString";
MessageBox.Show(sFieldRef); //How do I get this line to display: Here is a
test string???



I want the messagebox to show what's stored
in sString (Here is a test string) but by
only using sFieldRef.

I know in Clipper, this is referred to as Macro Expansion.
Not sure how to do this in c#

Thanks in Advance,

Chris

Remove the quotes around sString.
 

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