Results 1 to 4 of 4

Thread: Simple Logical Statement Problem (I'm a rookie to VB)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    72

    Question

    Ok this question is lame. But I searching for the answer on MSDN Online has turned up NADA. So I come to the benevolent souls on this message board.

    Ok... I don't know how to use AND and OR statements in VB. Here is my code snipit. If figured it has something to do with the parenthesis and the "&". Maybe someone can help a brotha' out.

    Do While ((currentArrayLocation < 10) & (inTopTen = False))
    If (Worksheets("Sheet5").Range("H" & rangeInt).Value >= currentArray(currentArrayLocation).clicks) Then
    inTopTen = True
    Else
    currentArrayLocation = currentArrayLocation + 1
    End If
    Loop


    Thanks in advance,
    cLocKwOrk

  2. #2
    Guest
    You're right. The symbol "&" refers to BIT-WISE, that is
    each bit is check against the other and all must be the
    same. Its kinda like looking for an exact match.

    The function AND will check that each element is a true
    statement. Irrespective of the individual values of the
    variables.

    Dump the &, use AND


    Good Luck
    DerFarm

  3. #3
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    Try

    In VB, "&" is a string concatenation operator: Try "And" instead. Use "Or" and "Xor" for other logical operations.
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    72

    Talking Sweet

    Sweeeeeeeeeeeeeet!

    Thanks for the help guys. =)

    -cLocKwOrk

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