Can you have something like this:
Do While True
strVarName = ds.Tables("MyTable")(iRow)("varname")
strVarValue = ds.Tables("MyTable")(iRow)("varvalue")
If Execute(strVarName, strVarValue) Then Exit Do
'If the function returns True, the loop will exit.
Loop
Private Function Execute(ByVal sVarName As String, ByVal sVarValue As String) As Boolean
'Your code here
End Function
Or am I grossly misunderstanding the question?
Begginnerdev
Practically a Posting Shark
893 posts since Apr 2010
Reputation Points: 198
Solved Threads: 149
Skill Endorsements: 9
after this there existed a variable with the name and value as requested
This sounds like a key-value pair to me. Perhaps a Dictionary will work.
TnTinMN
Practically a Master Poster
640 posts since Jun 2012
Reputation Points: 418
Solved Threads: 149
Skill Endorsements: 13
vbScript had the functions, Execute and ExcecuteGlobal which allowed runtime execution of VB expressions (strings) with various levels of scoping. As I recall, this feature is not available in VB.net 2010 but might be have been restored in VB.net 2012. If you really need to execute dynamic code then you might look into VB 2012. If you don't mind handling the dynamic expressions yourself (ie maintaining your own symbol table) then TnTinMN's suggestion is likely your best bet.
Reverend Jim
Illigitimae non carborundum
3,737 posts since Aug 2010
Reputation Points: 585
Solved Threads: 469
Skill Endorsements: 33
Ancient Dragon
Achieved Level 70
32,274 posts since Aug 2005
Reputation Points: 5,852
Solved Threads: 2,590
Skill Endorsements: 70
If it's dynamic code execution, then that can be handled via CodeDom and compile on the fly. Not to difficult to do, but takes some setup to get right.
But based on my understanding of the OP's stated situation, it looks like just some value that needs to be referenced by name.
TnTinMN
Practically a Master Poster
640 posts since Jun 2012
Reputation Points: 418
Solved Threads: 149
Skill Endorsements: 13
Question Answered as of 3 Months Ago by
TnTinMN,
Ancient Dragon,
Begginnerdev
and 1 other