How can you, in VB.Net, evaluate the value of controls referenced in a string? Suppose you have a textbox N containing some alphanumeric content and it were referenced in a string variable like this:
Dim s As String = """Hello "" & N.Text & ""!"""
I'd like to be able to reevaluate the contents of the s variable elsewhere in the code (where there's no direct knowledge of the existence of N), for example, like this:
Dim e As String = Eval(s)
This isn't possible with VB.Net; no such Eval function is available. I've seen some nearly plausible solutions online such as using the old COM ScriptControl:
Private Shared _scriptControl As MSScriptControl.ScriptControl = New ScriptControl()
_scriptControl.Language = "VBScript"
Dim e As String = _scriptControl.Eval(s)
However, the reference to the N.Text property of a Windows Forms control is alien to the ScriptControl object, and therefore it throws an error.
Is there any other quick fix that won't require the purchase of a third-party component?