|
-
Feb 19th, 2004, 03:59 PM
#1
Thread Starter
Addicted Member
A strang request, and operator through a variable?
Not sure how to ask this question exactly, so here goes....Is there a way in .NET to use an operator as a variable, for example, instead of saying...
VB Code:
sOperator = "="
Select Case sOperator
Case "="
If sExpression1 = sExpression2 Then
'do something
End If
Case "<="
If sExpression1 <= sExpression2 Then
'do something
End If
Case ">="
If sExpression1 >= sExpression2 Then
'do something
End If
Case "<"
If sExpression1 < sExpression2 Then
'do something
End If
Case ">"
If sExpression1 > sExpression2 Then
'do something
End If
Case "<>"
If sExpression1 <> sExpression2 Then
'do something
End If
End Select
do something like this...
VB Code:
sOperator = "="
If sExpression1 sOperator sExpression2 Then
'do something for every situation
End If
Now I know trying to do it exactly how I've written it here doesn't work, but you should get my point. Is there a way anyone has used before to utilize this same functionality? What I'm trying to do is provide different conditions to the user, and making the operator selectable for themt.
Any ideas and/or opinions are welcomed.
Thanks!
Sibby
If you can think it....you can code it....
-
Feb 19th, 2004, 05:54 PM
#2
Frenzied Member
What data type would you dim sOperator???
There is the problem.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Feb 19th, 2004, 09:32 PM
#3
Thread Starter
Addicted Member
ummm...
As I had stated in my innitial post...I KNOW it's not going to work this way. I just wrote it psuedocode like this to illustrate my point. I'm just wondering if anyone has implimented a type of scheme like this before and wouldn't mind sharing thier logic.
Sibby
If you can think it....you can code it....
-
Feb 20th, 2004, 03:58 AM
#4
yay gay
You can create an enumeration with the operators
\m/  \m/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|