Jon,

I think what you're asking is impossible - sounds like reflection on
variable names.

Just use a Dictionary<string, string>, make your array 2 dimensional
or pass in an object with properties like FirstName...

-- Brian


On 4/19/07, Jon Rothlander <[EMAIL PROTECTED]> wrote:
I have a string with the value of say "FirstName".  I also have a string
named FirstName... so they match.  Then I have a TextBox with a tag of
"FirstName".  What I want to do is get the value of the FirstName string
into the value of the textbox.

That's kind of hard to follow.  Here's the basic idea.  Let's just assume
that textbox1 has a tag of "FirstName".  I can handle that part of the code.
The problem is pulling the value of the string when you have the name of the
string... not to the string object itself.  Here's the idea...

Dim FirstName as string = "Jon"
Dim LastName as string = "Rothlander"

Dim TextBox1 as Textbox

TextBox1.Text = TheValueOfTheStringNamed("FirstName")

Msgbox(Textbox1.Text) 'Should equal "Jon"

The problem is that I have to build a loop that loops though an array with
all of the string names that I want to do this to.  So I do not have the
actual object.  What I need to do is figure out how to get the value out of
the strings without hardcoding a declaration to that string.

I know that I have done this a number of times in the past and even back in
VB6.  I just cannot recall how to do this.  If I remember correctly, you are
able to create another string and set it equal to the string that is already
created...  something like...

Dim FirstName as string = "Jon"
Dim NewString as String = New CreateCopyOf("FirstName")
Textbox1.text = newstring.text   'Now the textbox contains... "Jon"

Any ideas here?  How do I create the copy?

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com


===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to