Results 1 to 9 of 9

Thread: Whats the equivalent of '!=' or 'ne' in VB?

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    2

    Question

    I know howto do it in perl, but in VB how do you check if one variable doesn't equal another?

    I've tried searching through the forums, but haven't had any luck.

    Also, can someone tell me what the following is used for (inbetween the text variables)? I've seen it a lot in code examples.

    Code:
    Text1.Text <> Text2.Text
    Thanks A lot!

    Jacob Wheeler
    Co-Founder / Web Engineer - Big Resources, Inc.
    [email protected]
    http://www.bigresources.com

  2. #2
    Guest
    ehehehehehe........
    <> is not equals.....
    like != is not equals in C, and javascript

  3. #3
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    ...or you can look up the NOT keyword
    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  4. #4
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    I always use the Not keyword, it makes code clearer, it's the equivilent of ! in C++, so instead of

    If a<>b Then

    I go for

    If Not (a=b) Then

    for large statements good use of the Not, And (&&) and Or (||) are realy useful.

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Which is faster, <> or not?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    2

    Cool hehe

    I knew the answer had to be staring me in the face

    Thanks for the replies guys!
    Jacob Wheeler
    Co-Founder / Web Engineer - Big Resources, Inc.
    [email protected]
    http://www.bigresources.com

  7. #7
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    Originally posted by kedaman
    Which is faster, <> or not?
    never tested it. I imagine that in acuality they'd be about the same but if I were to bet, I'd say that 'NOT' was faster, it implies one less operation...

    I imagine the difference would be difficult to detect if it in fact existed.

    Paul
    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Ok, i've tested it got 5,03 µs as a normal for both
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  9. #9
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    I tested it too,

    <> is faster than Not = for numbers
    Not is faster than <> for strings


    but the difference is really small

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