PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Checking labels caption-VBForums
Results 1 to 4 of 4

Thread: Checking labels caption

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    346

    Checking labels caption

    Hello, I am trying to check to see whether a labels caption is one of 3 numbers but it doesnt seem to be working, here is a bit of the code

    VB Code:
    1. If frmMain.lblDealer(i).Caption = "14" Or "27" Or "40" Then
    2.  
    3.     dt = dt + 1
    4.    
    5. ElseIf frmMain.lblDealer(i).Caption = "15" Or "28" Or "41" Then
    6.  
    7.     dt = dt + 2

    How should I check to see if the caption is equal to any of them numbers?

    Microsoft gives you Windows, Linux gives you the whole house!


    I am who I am because of who we all are.


    We have just gotten a wake up call from the Nintendo generation.

  2. #2
    Fanatic Member space_monkey's Avatar
    Join Date
    Apr 2005
    Location
    神と歩くこと
    Posts
    573

    Re: Checking labels caption

    I think you need to do it like this

    VB Code:
    1. If frmMain.lblDealer(i).Caption = "14" Or frmMain.lblDealer(i).Caption = "27" Or frmMain.lblDealer(i).Caption = "40" Then

    And the same for the ElseIf.

    HTH
    Using VB6 or VB.net 2008 with .net 3.5
    "Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad

  3. #3
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,257

    Re: Checking labels caption

    Use a select case statement:

    VB Code:
    1. Select Case frmMain.lblDealer(i).Caption
    2.  
    3.      Case "14"
    4.  
    5.           'Do code
    6.  
    7.      Case "27"
    8.  
    9.           'Do code
    10.  
    11.      'etc, etc, etc
    12.  
    13. End Select

  4. #4
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,177

    Re: Checking labels caption

    or if you want them all to fire on the same case

    VB Code:
    1. Select Case frmMain.lblDealer(i).Caption
    2.  
    3.      Case "14", "27", "40"
    4.      'do code
    5.      Case "15", "28", "41"
    6.      'do code
    7.      Case Else
    8.      'do code
    9. End Select

    and congratz on 2k posts JR

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width