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.
Tutorialspoint

code

Module VBModule
 
    Sub Main()
        
        'This is a declaration statement
        dim Age as integer 'this is a integer whole numbers only
        dim Name as string 'this is a string of characters
        'dim DoB as date 'this is date time datatype
        dim Gender as char ' this is a character
        dim Height as decimal 'this is in metres 
        dim license as boolean ' this is true or false
        
        'Assignment statements
        Age     = 38
        Name    = "ChuckNorris"
        'DoB     = 21/01/1980
        Gender  = "M"
        Height  = 2
        license = True
        
        
        Console.WriteLine("Hello, world! Mr " & Name )
        Console.Writeline("Your Age is " & Age)
        console.writeline("Your DOB is " & date)
        Console.Writeline("Your Gender is " & Gender)
        Console.write("Your height is: " & Height)
        Console.writeline(" Do you have a license: " &license)
        
    End Sub
  
End Module

Compile and Execute VB.Net Online

Module VBModule
 
    Sub Main()
        Console.WriteLine("Hello, world!")
    End Sub
  
End Module

VB.Net Basic Syntax Rectangle Class

Imports System
Public Class Rectangle
    Private length As Double
    Private width As Double

    'Public methods
    Public Sub AcceptDetails()
        length = 4.5
        length = 3.5
    End Sub

    Public Function GetArea() As Double
        GetArea = length *length
    End Function
    Public Sub Display()
        Console.WriteLine("Length: {0}", length)
        Console.WriteLine("Width: {0}", length)
        Console.WriteLine("Area: {0}", GetArea())

    End Sub

    Shared Sub Main()
        Dim r As New Rectangle()
        r.Acceptdetails()
        r.Display()
        Console.ReadLine()
    End Sub
End Class

Compile and Execute VB.Net Online

imports system
Public class rectengle 
Private length as double
Private width as double

Public sub Acceptdet()
length=4.5
width=3.5
End sub

Public function getarea() as double
getarea=length*width
End function

Public sub dis()
Console.WriteLine("length:{0}",length)
Console.WriteLine("width:{0}",width)
Console.WriteLine("Area:{0}",getarea())
End sub
  
    shared Sub Main()
       dim r as New rectengle()
       r.Acceptdet()
       r.dis()
       console.ReadLine()
       
    End Sub
  
End Class

ForCameron

Module VBModule
 
    Sub Main()
        dim y, phone, local as String
        phone = "(01234)567890"
        local = phone.Substring(7, 3)
        Console.writeline(local)
    End Sub
  
End Module

Confirmations

Module VBModule
 
    Sub Main()
        Console.WriteLine("Hello, world!")
    End Sub
  
End Module

6.12 12-1B-3b2 While

Module VBModule
 
    Sub Main()
        
        dim A As Integer = 1
        dim B As Integer = 1
        dim N As Integer = 0

        While B < 20
            A = A + B
            B = A - B
            N = N + 1
            'Console.WriteLine(A)
            Console.WriteLine(B)
        End While
        'Console.WriteLine(N)

    End Sub
  
End Module

Craig n Dave SLR1 Activity 6

Module VBModule
 
    Sub Main()
        dim y, x, phone, local, name as String
        y = "Welcome to Computing"
        x = UCase(Left(y, 7))						
        
        x = Left(Right("Welcome to computing", 12), 2)				
        
        y = "Mary had a little lamb"
        Console.writeline(Len(y))									
        
        y = "Dave had a little lamb. Mary's fleece was white as snow."
        Console.writeline(InStr(y,"Mary"))					
        
        phone = "(01234)567890"
        local = phone.Substring(7, 6)
        console.writeline(local)						
        
        name = "Craig"
        console.writeline("Hello " & name & ". How are you today?")		
        
        dim age as decimal
        age = CInt(50.27) 'converts the decimal into an integer
        console.writeline(age)	
    End Sub
  
End Module

Visual Basic.Net

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

test

Module VBModule
 
    Sub Main()
        Console.WriteLine("Hello, world!")
    End Sub
  
End Module

Previous 1 ... 6 7 8 9 10 11 12 ... 38 Next
Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.