CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    78

    IN or INLIST in VB???

    Hi,

    Is there a keyword similar to IN or INLIST in VB?
    For example, in SQL you have:
    SELECT * FROM table WHERE col IN(5,7,13,18);

    So, intead of having:
    If x=2 or x=8 or x=12 etc. .....
    you could have:
    if x IN(2,8,12)

    is there such a thing in VB?


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: IN or INLIST in VB???

    VB doesn't have this command, but you a select case can do this.

    Select case SomeValue
    Case 1, 4, 6 to 10, 12 ,13
    Msgbox "Somevalue is 1, 4, 6, 7, 8, 9, 10, 12 or 13"
    End Select




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

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

Featured