I'm trying to execute some code inside a string in runtime. I.E.
Dim code As String = "IIf(1 = 2, True, False)"
How do i run the code inside code string ?
I'm trying to execute some code inside a string in runtime. I.E.
Dim code As String = "IIf(1 = 2, True, False)"
How do i run the code inside code string ?
As @ElektroStudios said - the proper way to do this is to use the CodeDom compiler, but this is a bit overkill for something as simple as this.
You can sort of cheat and harness the power of a
DataColumn ExpressionSo for example:
You could wrap all this up into a more generic function like this:
So then you can call it like this: