Evaluating String Expression

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
 
C

CJ Taylor

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)
 
T

TheThirdDegree

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top