VB.
Net supports various operators that are used to perform operations on variables
and values. Here are some of the commonly used operators in VB.Net:
1.
Concatenation Operator:
& (Concatenation)+ (Addition)
- (Subtraction)
* (Multiplication)
/ (Division)
\ (Integer Division)
Mod (Modulus or Remainder)
Dim result As Integer
result = 10 + 5 ' result is 15
result = 10 - 5 ' result is 5
result = 10 * 5 ' result is 50
result = 10 / 5 ' result is 2
result = 10 \ 3 ' result is 3 (integer division)
result = 10 Mod 3 ' result is 1 (remainder)
2.
Comparison Operators:
= (Equal to)
<> (Not equal to)
< (Less than)
> (Greater than)
<= (Less than or equal to)
>= (Greater than or equal to)
Dim a As Integer = 10
Dim b As Integer = 5
Dim result As Boolean
result = (a = b) ' result is False
result = (a <> b) ' result is True
result = (a < b) ' result is False
result = (a > b) ' result is True
result = (a <= b) ' result is False
result = (a >= b) ' result is True
3.
Logical Operators:
And (Logical AND)
Or (Logical OR)
Not (Logical NOT)
Dim x As Boolean = True
Dim y As Boolean = False
Dim result As Boolean
result = x And y ' result is False
result = x Or y ' result is True
result = Not x ' result is False
4.
Concatenation Operator:
& (Concatenation)
Dim str1 As String = "Hello"
Dim str2 As String = "World"
Dim result As String
result = str1 & " " & str2 ' result is "Hello World"
5.
Assignment Operator:
`=` (Assignment)
Dim a As Integer
a = 10