How would I compile a string in VB.NET and then run it as code?
Posted on 2006-11-23
I have the following code which is in an event handler for a button:
With DirectCast(sender, Button)
Dim index As Integer
index = CInt(Microsoft.VisualBasic.Right(.Name, 1))
and then I would like to run something like this:
tbRFID8.Text = frmAssignTag.assignBox()
where the "8" in the "tbRFID8" is the index variable. So something like
tbRFID(index).Text = frmAssignTag.assignBox()
although I know that will not work. From my excel work I think i need the function which compiles the express something like
UnknownFunction("tbRFID" & index & ".Text") = frmAssignTag.assignBox()
Any help would be greatly appreciated. Thanks.