Results 1 to 2 of 2

Thread: Range of Value

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2007
    Posts
    36

    Range of Value

    I am wondering if it is possible to set a range of value. For example, I am trying to make it so a timer checks a label for integers 1 through 5.

    Instead having to write out

    Code:
    If Label1.Caption = "1" or "2" or "3" or "4" or "5"
    is there a way I could make it so it ranges from 1 to 5?

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Range of Value

    You can use Select Case, ie:

    vb Code:
    1. Select Case Val(Label1.Caption)
    2.     Case 1 To 5
    3.         'Do something
    4. End Select

    Edit, you can also do multiple ranges, ie:

    Case 1 To 5, 7 To 10, etc.

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