Department of Computer Science (UG)
Bachelor of Computer Application (BCA)
PRACTICAL RECORD
21BCA2L232: VISUAL PROGRAMMING
Submitted by:
NAME :
REG. NO :
CLASS : llI SEM BCA -
YEAR : 2023 - 2024
21BCA2L232: VISUAL PROGRAMMING PRACTICAL
LIST OF PROGRAMS
Page
Sl. Date Experiments
No No.
1 Develop an application for switch cases.
2 Develop a [Link] application for run time polymorphism.
3 Develop an application for compile time polymorphism.
4 Develop an application for interface example.
5 Develop an application for abstract classes.
6 Develop an application for facilitating purchase order.
7 Develop an application for billing system in coffee shops.
8 Develop an application for fruit billing system
9 Develop an application which is similar to a login form using
progress bar control.
10 Develop an application for Color dialog control.
11 Develop an application for tree view control in [Link].
12 Develop an application for Exception Handling.
13 Develop an application to read items from the database using data
reader
1. Develop an application for switch cases.
Aim:To develop an application for switch cases.
Step 1: Create a New Project by clicking File->New Project.
Step 2: Select Windows Form->Language as VB->Program Name
Code:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
[Link]
Dim a As Integer
a = InputBox("Enter your choice")
Select Case (a)
Case Is = "1"
[Link]("Today is Sunday")
Case Is = "2"
[Link]("Today is Monday")
Case Is = "3"
[Link]("Today is Tuesday")
Case Is = "4"
[Link]("Today is Wednesday")
Case Is = "5"
Visual Programming Practical 6
[Link]("Today is Thursday")
Case Is = "6"
[Link]("Today is Friday")
Case Is = "7"
[Link]("Today is Saturday")
Case Else
[Link]("Invalid input")
End Select
End Sub
End Class
Visual Programming Practical 7
Output
Visual Programming Practical 8
2. Develop a [Link] application for run time polymorphism.
Aim: To develop a [Link] application for run time polymorphism
Step 1: Create a New Project by clicking File->New Project.
Step 2: Select Windows Form->Language as VB->Program Name
Code:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
[Link]
Dim a As New A
[Link]()
End Sub
End Class
Public Class sample
Public a, b, c As Integer
Public Overridable Sub mul()
a = 12
b = 12
c=a*b
[Link]("The product is:" & c)
End Sub
End Class
Public Class A
Inherits sample
Public Overrides Sub mul()
a = 22
Visual Programming Practical 9
b = 22
c=a*b
[Link]("The product is:" & c)
End Sub
End Class
Visual Programming Practical 10
Output:
Visual Programming Practical 11
3. Develop an application for compile time polymorphism.
Aim:To develop an application for compile time polymorphism.
Step 1: Create a New Project by clicking File->New Project.
Step 2: Select Windows Form->Language as VB->Program Name
Code:
Public Class Form4
Private Sub Form4_Load(sender As Object, e As EventArgs) Handles
[Link]
Dim x As New test
[Link]()
[Link](2, 3)
End Sub
End Class
Public Class test
Dim a, b, c As Integer
Public Overloads Sub mul()
a = 12
b = 12
c=a*b
[Link]("The product is" & c)
End Sub
Public Overloads Sub mul(ByVal a As Integer, ByVal b As Integer)
Visual Programming Practical 12
c=a*b
[Link]("The product is" & c)
End Sub
End Class
Visual Programming Practical 13
Output:
Visual Programming Practical 14
4. Develop an application for interface example.
Aim:To develop an application for interface example.
Step 1: Create a New Project by clicking File->New Project.
Step 2: Select Windows Form->Language as VB->Program Name
Code:
Public Class Form2
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles
[Link]
Dim obj As New Test1
[Link]()
End Sub
End Class
Public Interface Mytest
Sub add()
End Interface
Public Class Test1
Implements Mytest
Public Sub add() Implements [Link]
[Link]("Hello from add")
End Sub
End Class
Visual Programming Practical 15
Output:
Visual Programming Practical 16
5. Develop an application for abstract classes.
Aim: To develop an application for abstraction class.
Step 1: Create a New Project by clicking File->New Project.
Step 2: Select Windows Form->Language as VB->Program Name
Code:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
[Link]
Dim s As New AB
[Link]()
[Link]()
End Sub
End Class
Public MustInherit Class abstractclass
Public MustOverride Function add() As Integer
Public MustOverride Function divide() As Integer
End Class
Public Class AB
Inherits abstractclass
Dim x, y AsUInteger
Public Overrides Function add() As Integer
x = 12
y = 23
[Link]("The sum is " & x + y)
Visual Programming Practical 17
End Function
Public Overrides Function divide() As Integer
x = 12
y = 23
[Link]("The division is " & x / y)
End Function
End Class
Visual Programming Practical 18
Output:
Visual Programming Practical 19
6. Develop an application for facilitating purchase order.
Aim: To develop an application for facilitating purchase order
Desgin:
Step 1: Create a New Project by clicking File->New Project.
Step 2: Select Windows Form->Language as VB->Program Name
Code:
Public Class Form1
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As
EventArgs) Handles [Link]
If [Link] = "Jaguar" Then
[Link]()
[Link]("Chronic black")
[Link]("White")
[Link]("Black")
[Link]("Blue")
[Link]()
[Link]("Ritz")
[Link]("800")
[Link]("Estilo")
End If
If [Link] = "Tata" Then
[Link]()
Visual Programming Practical 20
[Link]("Wine Red")
[Link]("White")
[Link]("Black")
[Link]("yellow")
[Link]()
[Link]("Nano")
[Link]("ACE")
[Link]("Sumo")
End If
If [Link] = "Mahindra" Then
[Link]()
[Link]("Sand silver")
[Link]("White")
[Link]("Black")
[Link]("Silver")
[Link]()
[Link]("SUV")
[Link]("Bolero")
[Link]("KUV")
End If
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
[Link]
[Link]("XF")
[Link]("XJ")
[Link]("XE")
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
[Link]
If [Link] = ("Ritz") Then
[Link] = "5.2 lakhs"
End If
If [Link] = ("800") Then
[Link] = "5.0 lakhs"
End If
If [Link] = ("Estilo") Then
[Link] = "5.5 lakhs"
End If
Visual Programming Practical 21
If [Link] = ("Nano") Then
[Link] = "3.2 lakhs"
End If
If [Link] = ("ACE") Then
[Link] = "6.2 lakhs"
End If
If [Link] = ("Sumo") Then
[Link] = "5.7 lakhs"
End If
If [Link] = ("XUV") Then
[Link] = "7.2 lakhs"
End If
If [Link] = ("Bolero") Then
[Link] = "6.8 lakhs"
End If
If [Link] = ("KUV") Then
[Link] = "6.0 lakhs"
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
[Link]
[Link]()
[Link]()
[Link] = ""
[Link]()
End Sub
End Class
Visual Programming Practical 22
Output:
Visual Programming Practical 23
7. Develop an application for billing system in coffee shops
Aim: to develop an application for billing system in coffee
shops
Design:
Step 1: Create a New Project by clicking File->New Project.
Step 2: Select Windows Form->Language as VB->Program Name
Code:
Public Class Form1
Dim A, B As Double
If [Link] = True Then
[Link] = False
[Link] = False
[Link] = False
If [Link] = True Or [Link] = True Then
A = Val([Link]) * 2
B = Val([Link]) * 7
[Link] = A + B
Else
A = Val([Link]) * 3
B = Val([Link]) * 5
[Link] = A + B
End If
ElseIf [Link] = True Then
[Link] = False
[Link] = True
If [Link] = Nothing Then
[Link]("Enter you card number")
ElseIf [Link] = True Then
[Link]("Payment sucessful")
End If
If [Link] = True Or [Link] = True Then
A = Val([Link]) * 2
B = Val([Link]) * 7
[Link] = A + B
Else
A = Val([Link]) * 3
B = Val([Link]) * 5
[Link] = A + B
End If
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles [Link]
[Link] = " "
[Link] = " "
[Link] = " "
[Link] = " "
[Link] = True
[Link] = True
[Link] = False
[Link] = False
[Link] = True
[Link] = True
End Sub
End Class
Visual Programming Practical 25
Output:
Visual Programming Practical 26
8. Develop an application for fruit billing system.
Aim: to develop an application for fruit billing system.
Design:
Step 1: Create a New Project by clicking File->New Project.
Step 2: Select Windows Form->Language as VB->Program Name
Code:
Public Class Form3
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
[Link]
[Link]()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
[Link]
If [Link] = True Then
[Link] = Val([Link]) * 10
Visual Programming Practical 27
[Link] = "The total cost is " + [Link]
ElseIf [Link] = True Then
[Link] = Val([Link]) * 12
[Link] = "The total cost is " + [Link]
ElseIf [Link] = True Then
[Link] = Val([Link]) * 16
[Link] = "The total cost is " + [Link]
End If
End Sub
End Class
Visual Programming Practical 28
Output:
Visual Programming Practical 29
Visual Programming Practical 30
9. Develop an application which is similar to a login form using
progress bar control.
Aim: To develop an application which is similar to a login formusing progress bar
control.
Design:
Step 1: Create a New Project by clicking File->New Project.
Step 2: Select Windows Form->Language as VB->Program Name
Code:
Public Class Form2
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles
[Link]
[Link] = 0
[Link] = 100
[Link] = 0
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
[Link]
Visual Programming Practical 34
If [Link] = "kjc" And TextBo
[Link] = "123" Then
[Link] = 100
[Link]("Username is authenticated")
Else
[Link]("Recheck your username and password")
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
[Link]
[Link]()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles
[Link]
[Link] = ""
[Link] = ""
End Sub
End Class
Visual Programming Practical 35
Output:
Visual Programming Practical 36
Visual Programming Practical 37
10. Develop an application for Color dialog control.
Aim:To develop an application for Color dialog control.
Design:
Step 1: Create a New Project by clicking File->New Project.
Step 2: Select Windows Form->Language as VB->Program Name
Code:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
[Link]
If [Link] = [Link] Then
[Link] = [Link]()
End If
End Sub
End Class
Visual Programming Practical 42
Output:
Visual Programming Practical 43
11. Develop an application for tree view control in [Link]
Aim:To develop an application for tree view control in [Link].
Design:
Step 1: Create a New Project by clicking File->New Project.
Step 2: Select Windows Form->Language as VB->Program Name
Code:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
[Link]
[Link]("Comupters")
[Link](0).[Link]("Software")
[Link](0).Nodes(0).[Link]("java")
[Link](0).Nodes(0).[Link](".net")
[Link](0).[Link]("Hardware")
[Link](0).Nodes(1).[Link]("Printer")
End Sub
Private Sub TreeView1_AfterSelect(sender As Object, e As
TreeViewEventArgs) Handles [Link]
[Link] = [Link]
Visual Programming Practical 44
[Link] = [Link]
End Sub
End Class
Output:
Visual Programming Practical 45
12. Develop an application for Exception Handling.
Aim:To develop an application for Exception handling.
Step 1: Create a New Project by clicking File->New Project.
Step 2: Select Windows Form->Language as VB->Program Name
Code:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
[Link]
Dim a As New Divide
[Link](12, 0)
End Sub
End Class
Public Class Divide
Dim c As Integer
Function divide(ByVal a As Integer, ByVal b As Integer) As Integer
Try
c=a/b
Catch ex As Exception
[Link]("Divide by zero's exception")
End Try
End Function
End Class
Visual Programming Practical 46
Output:
Visual Programming Practical 47
13. Develop an application to read items from the database using
data reader.
Aim: To develop an application to read items from the database using data reader.
Design:
Step 1: Create a New Project by clicking File->New Project.
Step 2: Select Windows Form->Language as VB->Program Name
Step 3: Create a database by the name Database1, Create a table details with the
following fields: id,fname , lname , phoneno , postal code.
Step 4: Enter the details manually into database.
Code:
Imports [Link]
Public Class Form1
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
[Link]
[Link] = "Data Source=(localdb)\v11.0;Initial
Catalog=employee;Integrated Security=True;Connect
Timeout=15;Encrypt=False;TrustServerCertificate=False"
[Link]()
Visual Programming Practical 52
[Link] = con
[Link] = "select empid from emp"
Dim dr1 As SqlDataReader
dr1 = [Link]
Do While [Link]
[Link](dr1("empid"))
Loop
[Link]()
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As
EventArgs) Handles [Link]
Dim dr2 As SqlDataReader
Dim cmd2 As New SqlCommand
[Link] = con
[Link] = "select
emp_fname,emp_lname,city,phoneno,postalcode from emp where empid=" &
"(@empid)"
Dim parameterstate As New SqlParameter("@empid", [Link])
[Link] = [Link]
[Link] = [Link]
[Link](parameterstate)
dr2 = [Link]
Do While [Link]
[Link] = dr2("emp_fname")
[Link] = dr2("emp_lname")
[Link] = dr2("city")
[Link] = dr2("phoneno")
[Link] = dr2("postalcode")
Loop
[Link]()
End Sub
End Class
Visual Programming Practical 53
Output:
Visual Programming Practical 54
Visual Programming Practical 57