Search | Contact | Link To Us  


      VB .NET       

.NET Defined
OOP with VB
VB Language
Win Forms
Windows Controls
ADO .NET
User Controls
File Handling
Multithreading
Deployment
XML Web Services Essential XML
Resources
Discussions
ASP.NET
About



Advertisement

visual basic, .net operators, .net arithematic operators, operators in .net, visual basic.net, .net languages, microsoft .net, .net assemblies, .net controls, microsoft languages, programming, progrmmaing .net, programming vb.net, compiling assemblies, compile .net applications,programming visual basic.net








     Home> VB LanguageOperators> Code Samples


Operators

Code Samples

Arithmetic Operators

Imports System.Console
Module Module1

Sub Main()
Dim x, y, z As Integer
x = 30
y = 20
z = x + y
WriteLine("Addition" & " = " & z)
z = x - y
WriteLine("Subtraction" & " = " & z)
z = x * y
WriteLine("Multiplication" & " = " & z)
z = x / y
WriteLine("Division" & " = " & z)
Read()
End Sub

End Module

The image below displays output from above code.

Concatenation Operators

Imports System.Console
Module Module1

Sub Main()
Dim str1, str2, str3, str4 As String
str1 = "Concatenation"
str2 = "Operators"
str3 = str1 + str2
WriteLine(str3)
str4 = str1 & str2
WriteLine(str4)
Read()
End Sub

End Module

The image below displays output from above code.

Comparison Operators

Imports System.Console
Module Module1


Sub Main()
Dim x, y As Integer
WriteLine("enter values for x and y ")
x = Val(ReadLine())
y = Val(ReadLine())
If x = y Then
WriteLine("x is equal to y")
ElseIf x < y Then
WriteLine("x is less than y")
ElseIf x > y Then
WriteLine("x is greater than y")
End If
Read()
End Sub

End Module

The image below displays output from above code.

Logical / Bitwise Operators

Imports System.Console
Module Module1

Sub Main()
Dim x As Boolean
x = Not 45 > 26
WriteLine("x not is false")
' x equals false
x = Not 26 > 87
' x equals True
WriteLine("x not is true")
Read()
End Sub

End Module

The image below displays output from above code.

 

  Privacy Policy | Terms of Use | Site Map | Contact

  © 2004-2010 Startvbdotnet.com. All rights reserved.

v