Evaluating String Expression

  • Thread starter Thread starter Ashok
  • Start date Start date
A

Ashok

Dear

Plese help me.
if there is
x=5
y=10
now i want z=15
z="x+y"

How it is possible?
Please help me.

Thanks
 
What are the datatypes of x and y?

if there ints, then z = x+y

by doing z = "x+y" your just creating a string or a literal that way.
Meaningless.

Now if X and y are strings, then you want to call z = int.parse(x) +
int.parse(y)
 
I don't know much about vb.NET but what other programming languages tought
me is that you shouldn't put variables between quote marks. If you do then
what's between the quotes will be seen as a string. So try z=x+y and see if
it does anything for you.
 
Back
Top