Results 1 to 9 of 9

Thread: select case [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    select case [RESOLVED]

    If you need to use a select case statement and you want to determine the value of the first few characters of a string, is there a way to 'include' a range rather than using 'or' statments?

    ex:
    VB Code:
    1. Select Case true
    2.             Case Node.StartsWith("N25") Or _
    3.                       Node.StartsWith("N30") Or _
    4.                       Node.StartsWith("N35") Or _
    5.                       Node.StartsWith("N40") Or _
    6.                       Node.StartsWith("N45")
    7.                 Return "192.168.4.237"
    8.  
    9.             Case Node.StartsWith("N55") Or _
    10.                       Node.StartsWith("N65") Or _
    11.                       Node.StartsWith("N70") Or _
    12.                       Node.StartsWith("N50")
    13.                 Return "192.168.4.235"
    14.  
    15.             Case Node.StartsWith("N95") Or _
    16.                   Node.StartsWith("N75") Or _
    17.                   Node.StartsWith("N80") Or _
    18.                   Node.StartsWith("N85") Or _
    19.                   Node.StartsWith("N90") Or _
    20.                   Node.StartsWith("N100") Or _
    21.                   Node.StartsWith("N105")
    22.                 Return "192.168.4.239"
    23.  
    24.  
    25.         End Select
    here, I'm checking for a 'prefix' and it returns an ip address. is there a better way to write that?
    Last edited by Andy; Aug 13th, 2004 at 12:11 PM.

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