I am writing a program where a user selects two mathmatical operators:
LT -less than
GT -greater than
EQ -equal to
NEQ -not equal to
I have if statments to convert these to their symbol, but how can I then use this in a sum?
If it was just one operator I would use more if statments, but as its two sets it would be 48 lines, there has to be an easier way, i thought about using select case statments.
if anyone could point me in the right direction i would be greatful.
here is the code if it helps
'LineDestOp and LineSourceOp are the operators = OR < OR > OR <>
If LineSourceOp = "EQ" Then
LineSourceOp = "="
ElseIf LineSourceOp = "LT" Then
LineSourceOp = "<"
ElseIf LineSourceOp = "GT" Then
LineSourceOp = ">"
ElseIf LineSourceOp = "NEQ" Then
LineSourceOp = "<>"
End If
If LineDestOp = "EQ" Then
LineDestOp = "="
ElseIf LineDestOp = "LT" Then
LineDestOp = "<"
ElseIf LineDestOp = "GT" Then
LineDestOp = ">"
ElseIf LineDestOp = "NEQ" Then
LineDestOp = "<>"
End If
If InSourcePort & LineSourceOp & InSourcePort And InDestPort & LineDestOp & InDestPort Then
......
If InSourcePort & LineSourceOp & InSourcePort And InDestPort & LineDestOp & InDestPort Then
assume
InSourcePort - 80
LineSourceOp - the operator
InDestPort - 80
LineDestOp - the other operator
(the program in question generates code for cisco routers)
Another way to look at it would be if i have "2+5" stored in a variable how can calculate it?
from that I could solve my problem
thanks daniweb