Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Module DataTypes
Sub Main()
Dim b As Byte
Dim n As Integer
Dim si As Single
Dim d As Double
Dim da As Date
Dim c As Char
Dim s As String
Dim bl As Boolean
b = 1
n = 1234567
si = 0.12345678901234566
d = 0.12345678901234566
da = Today
c = "U"c
s = "Me"
If ScriptEngine = "VB" Then
bl = True
Else
bl = False
End If
If bl Then
'the oath taking
Console.Write(c & " and," & s & vbCrLf)
Console.WriteLine("declaring on the day of: {0}", da)
Console.WriteLine("We will learn VB.Net seriously")
Console.WriteLine("Lets see what happens to the floating point variables:")
Console.WriteLine("The Single: {0}, The Double: {1}", si, d)
End If
Console.ReadKey()
End Sub
End Module
Option Strict On
Module Module1
Function simetry(ByVal x As Integer) As Boolean
Dim y As Integer = 0
Dim b As Boolean
y = x Mod 10
While x > 10
x = x \ 10
End While
If y = x Then
b = True
End If
Return b
End Function
Function middlenumber(ByVal x As Integer) As Integer
Dim y As Integer = x
Dim n As Integer = 0
While y > 10
y = y \ 10
n = n + 1
End While
x = CInt((x - (x Mod 10)) / 10) - CInt(y * CInt(Math.Pow(10, n - 1)))
Return x
End Function
Sub Main()
Dim x As Integer = CInt(Console.ReadLine())
Dim b As Boolean = simetry(x)
While b = True
x = middlenumber(x)
If x < 10 Then Exit While
End While
If b = True Then
Console.WriteLine("Yes")
Else
Console.WriteLine("No")
End If
Console.ReadKey()
End Sub
End Module
Option Strict On
Module Module1
Function alpha(ByVal n As Integer) As Double
Return 1 / Math.Pow(2, n)
End Function
Sub Main()
Dim n As Integer = CInt(Console.ReadLine())
Dim n As Integer = CInt(Console.ReadLine())
Dim sum As Double = 0
For i As Integer = 1 To n
sum = sum + alpha(i)
Next
Console.WriteLine(sum)
Console.ReadKey()
End Sub
End Module
Public Class Hello
Public Greeting As string
Public Number As Integer
Public Example As string
Public Function Format( ) As String
Return Greeting & " " & Example
End Function
End Class
Module VBModule
Sub Main()
Dim h As New Hello()
h.Greeting = "got the class to work"
h.Number = 30
h.Example = "Making a object in Visual Basic.net is easier than in Java"
Console.WriteLine(h.Format)
Console.WriteLine(h.Number)
End Sub
End Module
Imports System
Public Class Rectangle
Private length As Double
Private width As Double
'Public methods
Public Sub AcceptDetails()
length = 4.5
width = 3.5
End Sub
Public Function GetArea() As Double
GetArea = length * width
End Function
Public Sub Display()
Console.WriteLine("Length: {0}", length)
Console.WriteLine("Width: {0}", width)
Console.WriteLine("Area: {0}", GetArea())
End Sub
Shared Sub Main()
Dim r As New Rectangle()
r.Acceptdetails()
r.Display()
Console.ReadLine()
End Sub
console.writeline("high {0}".high)
End sub
End Class