Results 1 to 3 of 3

Thread: shortening my code? - thought I had it but obviously not

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Glasgow,Scotland
    Posts
    281

    Hello again!

    I'm trying to shorten this code:

    If firstofsequence(1) = secondofsequence(1) Then
    Picture1.Print firstofsequence(1) & ",";
    End If
    If firstofsequence(1) = secondofsequence(2) Then
    Picture1.Print firstofsequence(1) & ",";
    End If
    If firstofsequence(1) = secondofsequence(3) Then
    Picture1.Print firstofsequence(1) & ",";
    End If
    If firstofsequence(1) = secondofsequence(4) Then
    Picture1.Print firstofsequence(1) & ",";
    End If

    I thought this would do it, but my program gives a different result:

    For x = secondofsequence(1) To secondofsequence(4)
    If firstofsequence(1) = x Then
    Picture1.Print firstofsequence(1) & ",";
    End If
    Next

    Could you please tell me if the above is right or wrong?

    Thanks for any help!

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    easy enought to check
    add a list box for testing and do a visual of what
    you are sending

    For x = secondofsequence(1) To secondofsequence(4)

    list1.additem firstofsequence(1) & " " & x

    If firstofsequence(1) = x Then
    Picture1.Print firstofsequence(1) & ",";
    End If
    Next
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Addicted Member
    Join Date
    Jan 2000
    Location
    Oshkosh, WI
    Posts
    163
    I think this is what you want:

    [Code]

    For x = 1 To 4
    If firstofsequence(1) = secondofSequence(x) Then
    Picture1.Print firstofsequence(1) & ",";
    End If
    Next

    Glenn D
    Development/Analyst

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