Results 1 to 4 of 4

Thread: A strang request, and operator through a variable?

  1. #1

    Thread Starter
    Addicted Member Sibby's Avatar
    Join Date
    Feb 2001
    Location
    Milwaukee, WI *The United States of America*
    Posts
    144

    Question 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:
    1. sOperator = "="
    2.  
    3.             Select Case sOperator
    4.                 Case "="
    5.                     If sExpression1 = sExpression2 Then
    6.                         'do something
    7.                     End If
    8.                 Case "<="
    9.                     If sExpression1 <= sExpression2 Then
    10.                         'do something
    11.                     End If
    12.                 Case ">="
    13.                     If sExpression1 >= sExpression2 Then
    14.                         'do something
    15.                     End If
    16.                 Case "<"
    17.                     If sExpression1 < sExpression2 Then
    18.                         'do something
    19.                     End If
    20.                 Case ">"
    21.                     If sExpression1 > sExpression2 Then
    22.                         'do something
    23.                     End If
    24.                 Case "<>"
    25.                     If sExpression1 <> sExpression2 Then
    26.                         'do something
    27.                     End If
    28.             End Select

    do something like this...

    VB Code:
    1. sOperator = "="
    2.  
    3.             If sExpression1 sOperator sExpression2 Then
    4.                 'do something for every situation
    5.             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....

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    What data type would you dim sOperator???
    There is the problem.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3

    Thread Starter
    Addicted Member Sibby's Avatar
    Join Date
    Feb 2001
    Location
    Milwaukee, WI *The United States of America*
    Posts
    144

    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....

  4. #4
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    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
  •  



Click Here to Expand Forum to Full Width