|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Application developers can seamlessly integrate the Advantage Database install with their application install. Learn the best practices used when setting up silent installs with this seminar. |
|
#1
|
||||
|
||||
|
Storing & Using Operators
Hi
I have a situation where I need to store an operator (i.e. * or /) I then want to retrieve this operator and use it in a calculation. e.g. Store * in a database Retrieve the * from database Assign * to a variable Dim strVariable strVariable = * intResult = 1 strVariable 2 'Result being 2 Can anyone help please |
|
#2
|
|||
|
|||
|
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
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Storing & Using Operators |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|