0% found this document useful (0 votes)
95 views4 pages

Visual Basic

Visual Basic (VB) is a high-level, object-oriented programming language developed by Microsoft, known for its simplicity and rapid application development capabilities. Key features include event-driven programming, an integrated development environment, and rich library support. The document also covers VB syntax basics, control structures, procedures, functions, and object-oriented programming concepts.

Uploaded by

online school
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views4 pages

Visual Basic

Visual Basic (VB) is a high-level, object-oriented programming language developed by Microsoft, known for its simplicity and rapid application development capabilities. Key features include event-driven programming, an integrated development environment, and rich library support. The document also covers VB syntax basics, control structures, procedures, functions, and object-oriented programming concepts.

Uploaded by

online school
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Visual Basic (VB) Notes

1. Introduction to Visual Basic


 Visual Basic (VB) is a high-level, object-oriented programming language developed
by Microsoft.
 It is part of the .NET framework and is widely used for developing Windows
applications.
 VB is known for its simplicity and rapid application development
(RAD) capabilities.

Key Features:

✔ Event-driven programming – Code executes in response to user actions (e.g.,


button clicks).
✔ Integrated Development Environment (IDE) – Provides tools like drag-and-
drop controls.
✔ Object-Oriented Programming (OOP) – Supports classes, inheritance, and
polymorphism.
✔ Rich library support – Access to the .NET Framework for advanced functionalities.

2. VB Syntax Basics
A. Structure of a VB Program
vb
Module Module1
Sub Main()
Console.WriteLine("Hello, World!")
End Sub
End Module

B. Comments
vb
' This is a single-line comment
''' <summary>
''' This is a multi-line XML comment
''' </summary>

C. Variables & Data Types

Data Type Description Example

Integer Whole numbers Dim num As Integer = 10

Double Floating-point numbers Dim price As Double = 19.99

String Text Dim name As String = "John"

Boolean True/False Dim isTrue As Boolean = True

Date Date & Time Dim today As Date = Date.Now

D. Operators

 Arithmetic: +, -, *, /, ^ (exponent), Mod (modulus)


 Comparison: =, <>, >, <, >=, <=
 Logical: And, Or, Not, Xor

E. Input & Output


vb
Console.WriteLine("Output text") ' Writes a line
Console.ReadLine() ' Reads user input

3. Control Structures
A. Conditional Statements

If-Else
vb
If condition Then
' Code
ElseIf condition2 Then
' Code
Else
' Code
End If

Select Case
vb
Select Case variable
Case value1
' Code
Case value2
' Code
Case Else
' Default code
End Select

B. Loops

For Loop
vb
For i = 1 To 10
Console.WriteLine(i)
Next

While Loop
vb
While condition
' Code
End While

Do While / Do Until
vb
Do While condition
' Code
Loop

Do Until condition
' Code
Loop

4. Procedures & Functions


A. Sub Procedures (No return value)
vb
Sub Greet(name As String)
Console.WriteLine("Hello, " & name)
End Sub

B. Functions (Returns a value)


vb
Function Add(a As Integer, b As Integer) As Integer
Return a + b
End Function

5. Object-Oriented Programming (OOP) in VB


A. Classes & Objects
vb
Class Person
Public Name As String
Public Age As Integer

Sub Display()
Console.WriteLine($"Name: {Name}, Age: {Age}")
End Sub
End Class

' Creating an object


Dim p1 As New Person()
p1.Name = "Alice"
p1.Age = 25
p1.Display()

B. Inheritance
vb
Class

You might also like