Visual Basic.NET
  Home arrow Visual Basic.NET arrow Types of Operators in Visual Basic
Iron Speed
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Types of Operators in Visual Basic
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 5
    2007-09-13

    Table of Contents:
  • Types of Operators in Visual Basic
  • The Like Operator
  • Operator Overloading
  • Operator Precedence

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    Iron Speed
     
    ADVERTISEMENT

    TestComplete™ automates software testing for a fraction of what the big guys charge. Easy functional and load testing for all Windows, .NET, Java and Web apps. Download a free trial now.

    Types of Operators in Visual Basic
    (Page 1 of 4 )

    In this second part of a two-part article, you will learn about comparison operators, the like operator, and more. It is excerpted from chapter five of the book Visual Basic 2005 in a Nutshell, Third Edition, written by Tim Patrick, Steven Roman, Ph.D., Ron Petrusha and Paul Lomax (O'Reilly; ISBN: 059610152X). Copyright © 2006 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

    Comparison Operators

    There are three main comparison operators: < (less than), > (greater than), and = (equal to). They can be used individually, or any two operators can be combined with each other to form other comparison operators. The general syntax is:

      result = expression1 <operator> expression2

    The result is a Boolean value of True or False.

    The following list indicates the condition required with each VB comparison operator to return a value of True.

    = (Equal To)
       
    True if expression1  is equal to expression2

    < (Less Than)
       
    True if expression1  is less than (and not equal to)
      expression2

    > (Greater Than)
      True if expression1  is greater than (and not 
        equal to) expression2

    <= (Less Than or Equal To)
       True if expression1 is less than or equal to
       expression2

    >= (Greater Than or Equal To)
       True
    if expression1  is greater than or equal to
       expression2

    <> (Not Equal To)
       
    True if expression1  is not equal to expression2

    Comparison operators can be used with both numeric and string expressions. If one expression is numeric and the other is a string, the string is first converted to a number of type Double (nonnumeric strings throw an exception). If both expression1 and expression2 are strings, the "greatest" string is the one that appears second in sort order. The sorting is based on the current character code page in use by the application, the region-specific locale information, and the OptionCompare setting. If that setting is Binary, the comparison is case-sensitive, whereas a setting of Text results in a case-insensitive comparison.

    New in 2005. There are two "hidden" operators in Visual Basic: IsTrue(arg) and IsFalse(arg). They return a Boolean value that indicates whether the supplied argument is True or False, respectively. You cannot use them directly in your code, but they do exist, beginning in the 2005 release of Visual Basic, to support operator overloading. This is covered in the "Operator Overloading" section later in this chapter.

    More Visual Basic.NET Articles
    More By O'Reilly Media


       · This article is an excerpt from the book "Visual Basic 2005 in a Nutshell, Third...
     

    Buy this book now. This article is excerpted from chapter five of the book Visual Basic 2005 in a Nutshell, Third Edition, written by Tim Patrick, Steven Roman, Ph.D., Ron Petrusha and Paul Lomax (O'Reilly; ISBN: 059610152X). Check it out today at your favorite bookstore. Buy this book now.

    VISUAL BASIC.NET ARTICLES

    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...
    - Polymorphism using Abstract Classes in Visua...
    - Shadowing using Shadows in Visual Basic.NET ...
    - Overloading and Overriding in Visual Basic.N...
    - More on Controlling Windows Fax Services Usi...
    - Programmatically Controlling Windows Fax Ser...
    - Focusing on Forms and Menus in Visual Basic
    - Manipulating Forms with the Windows Forms Li...
    - Basics of the Windows Forms Library
    - Forms, Controls, and Other Useful Objects
    - Implementing OOP to Develop Database Oriente...
    - Using Themes and Skins for Personalization w...
    - A Deeper Look at Personalization using Visua...




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway