Hello there,

I need to write a simple app in VB and I need to know if is it possible to run code written in a string variable and evaluate .
I.e., let's say I have this:

___________________________________
Dim s as string

s="""The current year is "" & CStr(year(date))"

msgbox evaluate(s)
___________________________________

where the evaluate function should return the result of evaluating the expresion within string s


Thanks in advance,
Rares

in the evaluate function, you may need to use split to rip apart the expression, and then assign the elements of the variant array to the respective variable types.... Or don't use string, use variant.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.