Practical_Visual Basic KUSHAL
Practical_Visual Basic KUSHAL
1st Semester
Session 2024-2026
This is to certify that KUSHAL S/O Mr. Rajesh kumar has submitted
a practical file for fulfilment of MCA 1 st semester lab course for Visual Basic &
Database Systems.
3 Write a program to take input of principal, rate and time and calculate simple interest
and compound interest.
4 Write a program to design an interface, which will appear like mark sheet. It will take
input of marks in five subjects and calculate total marks and percentage then provide
grade according to following criteria. (Using nested if) (Use tab index property to move
focus).
If % Then Grade
> = 90 A+
> = 75 & < 90 A
> = 60 & < 75 B
> = 45 & < 60 C
Otherwise F
6 Write a program to check whether an entered no. is prime or not. (Using for loop &
while).
11 WAP to illustrate call by value and call by reference (to swap to values)
12 WAP to find smallest among given three numbers using user defined procedures.
End Sub
End Class
Output:
Practical 3
Aim: Write a program to take input of principal, rate and time and calculate simple
interest and compound interest.
principle = Val(pTxt.Text)
rate = Val(rTxt.Text)
time = Val(tTxt.Text)
End Sub
End Class
Output:
Practical 4
Aim: Write a program to design an interface, which will appear like mark sheet. It will
take input of marks in five subjects and calculate total marks and percentage then
provide grade according to following criteria. (Using nested if) (Use tab index property to
move focus).
If % Then Grade
> = 90 A+
> = 75 & < 90 A
> = 60 & < 75 B
> = 45 & < 60 C
Otherwise F
gradeTxt.Text = grade
End Sub
End Class
Output:
Practical 5
Aim: Write a program to print no 1 to 20.
num = Val(TextBox1.Text)
If isflrime Then
MsgBox(num fi " is a prime number")
Else
MsgBox(num fi " is not a prime number")
End If
End Sub
End Class
Output:
Practical 7
Aim: Write a program to search an element in array.
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
End Sub
End Class
Output:
Here we are finding the element in predefined array inside the code and not in dynamic array.
17
Practical 8
Aim: Write a program to sort a dynamic array of n numbers
For i As Integer = 0 To n - 2
For j As Integer = 0 To n - i - 2
If arr(j) > arr(j + 1) Then
temp = arr(j)
arr(j) = arr(j + 1)
arr(j + 1) = temp
End If
ext
ext
End Sub
End Class
Output:
Practical 9
Aim: Write a program to take input of two matrices and perform their addition
MsgBox(resultString)
End Sub
End Class
Output:
Entering the size of Matrix
Here we are performing some operations on a collection which is predefined in the program and is not
dynamic.
24
Practical 11
Aim: Write a program to illustrate call by value and call by reference (to swap to values)
End Sub
flrivate Sub SwapByValue(ByVal a As Integer, ByVal b As Integer)
Dim temp As Integer = a
a = b
b = temp
End Sub
Return smallest
End Function
End Class
Output:
Practical 13
Aim: Write a program to display picture and image control.
29
Output:
30
Showing the Image
flublic Class question13
flrivate Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
' Get the image path from the TextBox
Dim imageflath As String =
"C:\Users\Admin\OneDrive\flictures\Screenshots\randomimage.png"