hi there
i am trying to write a general formula function in vb6 forexample

a = 40
b = 50
c = 60

i need to evaluate the string "A + B + C"

which has to return the summation of the string in terms of value

can some one help

in .net / java eval function can be used , is it possible to simulate a similar function in vb6

regards rambi

I just crufted this up real quick.... basically, what you have to do, is to "cast" each string variable to an integer (the "val" function would also work, instead of cint, but cint makes more sense here, since the values are integers and not doubles. So, you simply cast the string to an integer (with cint) and add the values:

Dim a As String
Dim b As String
Dim c As String

a = "40"
b = "50"
c = "60"

MsgBox CInt(a) + CInt(b) + CInt(c)

' /* Or We Could Use This, But The Above Makes Better Sense */

MsgBox Val(a) + Val(b) + Val(c)