
February 26th, 2003, 02:09 PM
|
|
Contributing User
|
|
Join Date: Mar 2001
Location: Dublin
Posts: 413
Time spent in forums: 2 h 18 m 18 sec
Reputation Power: 13
|
|
if you're just performing a one operator binary operation as in your example then just use
Code:
Public Function Calculate(ByVal operand1 As Double, ByVal operation As String, ByVal operand2 As Double
Dim retVal as Double
Select Case operation
Case "*": Let retVal = operand1 * operand2
Case "/": Let retVal = operand1 / operand2
Case Else:Call Err.Raise("todo")
End Select: Let Calculate=retVal
If you need to parse a more complicated expression then you'll need to use a binary tree / series of recursive functions, I think
|