hello everybody,
i started learning vb.net around 3-4 days ago. And now i playing with operators . There i have one doubt :

is it possible to treat string value like a operator ?

for example : let suppose , there are 2 variable named a ,b of integer type which will store 2 numeric values. and one variable of string type named opertor_type of string type which will store the operator symbol.

a=10
b=20
operator_type="+"

and here is where my doubt arise

a operator_type b              'for a+b

is that kind of statement allowed in vb.net or not ?
However i done it using switch statement.

Recommended Answers

All 2 Replies

What you are trying to do is indeed not possible.
There is something like operator overloading, but it is rarely needed in every day use of VB, so I would not spoil my learning energy on it right now.

thanks for quick reply.
i wanted to know to if there exist any other way to use strings as operator but i didn't find any useful that's why i created thread here and now i am sure that this is really very rare .

thanks.

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.