Tuesday, October 5, 2010

Comparison Operators

Page : 1 2 3 4 5 6 7 8 9 10 11 12 13 14

A comparison operator is used to compare two operands and returns a logical value based on whether the comparison is true or not.


Example

Dim a,b,c As Integer


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a = 10
b = 7

If a = b Then
MsgBox("A is equal to B")

ElseIf a <> b Then
MsgBox("A Not equal to B")

ElseIf a > b Then

MsgBox("A is Grager than B")

ElseIf a <>= b Then
MsgBox("A is Grager than or equal to B")

ElseIf a <= b Then MsgBox("A is Less than or equal to B") End If End Sub Output will be display in MessageBox