Jump to content

String used as variable

Recommended Posts

Ok I know that it can be done in javascript by using eval() but I can't seemed to find what I'm looking for in VB.Net, any help is greatly appreciated, Thanks.For i As Integer = 1 To 10

If Not sUserDefined_ & i Is Nothing Then

sb.Append("<COL_" & i & ">" & sUserDefined_ & i & "</COL_" & i & ">")

End If

NextThe sUserDefined_1 through 10 is passed in from a dll and then passed out through XML. In javascript this is accomplished as the following. for(x=1;x<10;x++){

if(eval("sUserDefined_" + x)){

//Build String


}Thanks in advance.

Link to post
Share on other sites

Why don't you make sUserDefined an array instead? Then you don't have to eval at all, which is very costly.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...