0% found this document useful (0 votes)
2 views33 pages

Programming in Visual Basic

This document is a practical file for a Visual Basic programming course, detailing various projects and their implementations, including text manipulation, prime number checking, interest calculations, mark list implementation, string manipulation, and calculator functions. Each project outlines the aim, algorithm, form design, coding, and results, demonstrating the application of Visual Basic in real-world scenarios. The file is submitted by a student named Reena for the MBA program at MR DAV Institute of Management Studies.

Uploaded by

Reena Saini
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)
2 views33 pages

Programming in Visual Basic

This document is a practical file for a Visual Basic programming course, detailing various projects and their implementations, including text manipulation, prime number checking, interest calculations, mark list implementation, string manipulation, and calculator functions. Each project outlines the aim, algorithm, form design, coding, and results, demonstrating the application of Visual Basic in real-world scenarios. The file is submitted by a student named Reena for the MBA program at MR DAV Institute of Management Studies.

Uploaded by

Reena Saini
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

PRACTICAL FILE

On
Programming in VB
(25IMSI204DS13)
Master of Business Administration
MBA 4th Semester
(2024-2026)

Submitted To Submitted By

Mr. Satnarain Name - Reena

Asst. Prof. Roll no……....

MR DAV Institute Of Management Studies

5th KM Stone, Sonepat Road Rohtak-124023

Phone : +91-8950066210, +91-9355671757

Email :- mrdavims@[Link] Website :- [Link]


Table of Content

Sr no. Content Page no.

1 Text Manipulation Using Alignment and Format


Function

2 Prime Number or Not Prime Number

3 Simple Interest and Compound Interest

4 Mark List Implementation

5 String Manipulation Using String Functions

6 Calculator – Addition, Subtraction,


Multiplication and Division Operations

7 Calculator – Purchase, Sales and Profit Using


Array Functions and Rich Text Box (RTF)

8 Employee Details using ADO

9 Pay Slip Using SQL and ADO Control

10 Bank Customer Database using Simple and


Multiple Arrays with ADO Control
Practical .No:1

TEXT MANIPULATION USING ALIGNMENT AND FORMAT FUNCTION

Aim:

To Write VB Program to perform the text manipulation using alignment and format
function

Algorithm:

Step 1: Start the Process

Step 2: Start All Programs Microsoft Visual Basic 6.0


Step 3: Open the Standard EXE window.
Step 4: Click New Project and Design the form.

Step 5: Design the forms and project according to the program using tools such as Label, Text
Box, Command Buttons etc., Properties and components.
Step 6: Write the code for respective tools and actions of the program using code window,
events, properties and methods.
Step 7: Save the forms, projects and Run the program.
Step 8: Check the results.
Step 9: Stop the Process
Form Design
Coding
Private Sub Command10_Click()
End
End Sub

Private Sub Command2_Click()


[Link] = 0
End Sub

Private Sub Command3_Click()


[Link] = 1
End Sub

Private Sub Command4_Click()


[Link] = True
End Sub

Private Sub Command5_Click()


[Link] = Format(Now, "short date")
End Sub

Private Sub Command6_Click()


[Link] = Format(Val([Link]), "1234")
End Sub

Private Sub Command7_Click()


[Link] = True
End Sub

Private Sub Command8_Click()


[Link] = 2
End Sub

Private Sub Command9_Click ()


[Link] = Format (Val ([Link]), ###$$")
End Sub
Output Form:

Result :

The above program has been executed successfully and the output is verified.
Practical .No:2

Prime Number or Not Prime Number

Aim:

To Write Visual Basic Program to find the given number is Prime or not

Algorithm:

Step 1: Start the Process

Step 2: Start All Programs Microsoft Visual Basic 6.0


Step 3: Open the Standard EXE window.
Step 4: Click, New Project and start Designing the form.

Step 5: Design the forms and project according to the program using tools such as Label, Text
Box, Command Buttons etc., Properties and components.
Step 6: Write a formula to find the given number is prime or not

Step 7: Write the code for respective tools and actions of the program using code window,
events, properties and methods.
Step 8: Save the forms, projects and Run the program.
Step 9: Check the results.
Step 10: Stop the Process.
Form Design

Coding:

Private Sub Command1_Click()

Dim i, j As Integer

Dim t As Boolean
i = [Link]
t = True
For j = 2 To (i-1)
If (i Mod j = 0) Then
t = True

Exit For
Else
t = False
End If
Next
If t = True Then

MsgBox (i & “ is a Prime Number”)


Else
MsgBox (i & “ is Not a Prime Number”)
End If
End Sub

Output Form:

Result

The above program has been executed successfully and the output is verified
Practical .No:3

SIMPLE INTEREST AND COMPOUND INTEREST

Aim:
To Write Visual Basic Program to calculate simple interest and compound interest.

Algorithm:
Step 1: Start the Process
Step 2: Start All Programs Microsoft Visual Basic 6.0
Step 3: Open the Standard EXE window.
Step 4: Click, New Project and start Designing the form.
Step 5: Design the forms and project according to the program using tools such as Label, Text
Box, Command Buttons etc., Properties and components.
Step 6: Write a formula to calculate simple interest and compound interest.
Step 7: Write the code for respective tools and actions of the program using code window,
events, properties and methods.
Step 8: Save the forms, projects and Run the program.
Step 9: Check the results.
Step 10: Stop the Process.

Form Design
Coding:

Private Sub Command1_Click()


[Link] = ([Link] * [Link] * [Link]) / 100

End Sub

Private Sub Command2_Click()


[Link] = [Link] * (1 + ([Link]) / 100)) ^ ([Link])
End Sub

Private Sub Command3_Click()

[Link] = “ “

[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
End Sub

Private Sub Command4_Click()


End
End Sub
Output Form:

Result

The above program has been executed successfully and the output is verified.
Practical .No:4

Aim: MARKLIST IMPLEMENTATION

To write a VB Program to implement Marklist by computing total, average and result.

Algorithm:

Step 1: Start the Process


Step 2: Start All Programs Microsoft Visual Basic 6.0
Step 3: Open the Standard EXE window.
Step 4: Click New Project and Design the form.
Step 5: Design the forms and project according to the program using tools such as Text Box,
Command Buttons etc., Properties and components.
Step 6: Write the formula for computing total, average and result of the student in the exam.
Step 7: Write the code for respective tools and actions of the program using code window,
events, properties and methods.
Step 8: Save the forms, projects and Run the program.
Step 9: Check the results.
Step 10: Stop the Process.

Form Design
Coding
Private Sub Command1_Click()
[Link] = Val([Link]) + Val([Link]) + Val([Link]) + Val([Link]) +
Val([Link])
[Link] = Val([Link] )/ 5
End Sub

Private Sub Command2_Click()


If Val([Link]) >= 50) & Val([Link]) >=50) Then
If Val([Link]) >= 50) & Val([Link]) >=50) Then
If Val([Link]) >= 50 Then
[Link] = Pass
Else
[Link] =Fail
End If
Else
[Link] =Fail
End If
Else
[Link] =Fail
End If
End Sub

Private Sub Command3_Click()


[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
End Sub

Private Sub Command4_Click()


End
End Sub
Output Form:

Result :

The above program has been executed successfully and the output is verified.
Practical. No 5

STRING MANIPULATION USING STRING FUNCTIONS

Aim : To Write Visual Basic Program to manipulate string using string functions

Algorithm:
Step 1: Start the Process
Step 2: Start All Programs Microsoft Visual Basic 6.0
Step 3: Open the Standard EXE window.
Step 4: Click, New Project and start Designing the form.
Step 5: Design the forms and project according to the program using tools such as Label, Text
Box, Command Buttons etc., Properties and components.
Step 6: Write a formula to calculate simple interest and compound interest.
Step 7: Write the code for respective tools and actions of the program using code window,
events, properties and methods.
Step 8: Save the forms, projects and Run the program.
Step 9: Check the results.
Step 10: Stop the Process.

Form Design
Coding:

Dim str1, str2, str3, str As String

Dim MyText, myPhrase As String

Private Sub Command1_Click()


str1 =”Visual”
str2 = “Basic”
str3 = “Welcome”
str = str1 + str2 + str3

MsgBox (str)
End Sub

Private Sub Command2_Click()

myPhrase = InputBox (“Enter your phrase”)


[Link] = Mid(myPhrase, 2, 6)
End Sub

Private Sub Command3_Click()


MyText = “Visual Basic 2017”
MsgBox (Len(MyText))
End Sub

Private Sub Command4_Click()


End
End Sub
Output Form:

Result

The above program has been executed successfully and the output is verified
Practical. No 6

Aim: CALCULATOR

To write a VB Program to implement calculator performing addition, subtraction,


multiplication and division operations.

Algorithm:

Step 1: Start the Process


Step 2: Start All Programs Microsoft Visual Basic 6.0
Step 3: Open the Standard EXE window.
Step 4: Click New Project and Design the form.
Step 5: Design the forms and project according to the program using tools such as Text Box,
Command Buttons etc., Properties and components.
Step 6: Write the formula for addition, subtraction, multiplication and division.
Step 7: Write the code for respective tools and actions of the program using code window,
events, properties and methods.
Step 8: Save the forms, projects and Run the program.
Step 9: Check the results.
Step 10: Stop the Process.

Form Design
Coding
Dim a, b, c As Integer
Dim op As Integer

Private Sub Command10_Click()


[Link] = [Link] + "0"
End Sub

Private Sub Command1_Click()


[Link] = [Link] + "1"
End Sub

Private Sub Command2_Click()


[Link] = [Link] + "2"
End Sub

Private Sub Command3_Click()


[Link] = [Link] + "3"
End Sub

Private Sub Command4_Click()


[Link] = [Link] + "4"
End Sub

Private Sub Command5_Click()


[Link] = [Link] + "5"
End Sub

Private Sub Command6_Click()


[Link] = [Link] + "6"
End Sub

Private Sub Command7_Click()


[Link] = [Link] + "7"
End Sub

Private Sub Command8_Click()


[Link] = [Link] + "8"
End Sub

Private Sub Command9_Click()


[Link] = [Link] + "9"
End Sub

Private Sub Command11_Click()


[Link] = [Link] + "."
End Sub

Private Sub Command12_Click()


op = 1
a = Val([Link])
[Link] = " "
End Sub

Private Sub Command13_Click()


op= 3
a = Val([Link])
[Link] = " "
End Sub

Private Sub Command14_Click()


op = 2
a = Val([Link])
[Link]= " "
End Sub

Private Sub Command15_Click()


op = 4
a = Val([Link])
[Link]= " "
End Sub

Private Sub Command16_Click()


[Link]= " "
End Sub

Private Sub Command17_Click()


b = Val([Link])
Select Case op
Case Is = 1
c= a+ b
Case Is = 2
c= a- b
Case Is = 3
c= a* b
Case Is = 4
c= a/ b
End Select
[Link]= c
End Sub

Private Sub Command18_Click()


End
End Sub
Output Form:

Result :

The above program has been executed successfully and the output is verified.
Practical. No 7

CALCULATOR
Aim:
To write a VB Program to present details like purchase, sales, profit, etc, by declaring array
functions and present details in a Rich Text Book Box (RTF).

Algorithm:

Step 1: Start the Process


Step 2: Start All Programs Microsoft Visual Basic 6.0
Step 3: Open the Standard EXE window.
Step 4: Click New Project and Design the form.
Step 5: Design the forms and project according to the program using tools such as Rich Text
Box, Command Buttons etc., Properties and components.
Step 6: Write the formula for purchase, sales and profit calculations.
Step 7: Write the code for respective tools and actions of the program using code window,
events, properties and methods.
Step 8: Save the forms, projects and Run the program.
Step 9: Check the results.
Step 10: Stop the Process.

Form Design
Coding

Dim p(1 To 4) As String

Private Sub Command1_Click()


p(1) = “The sales turnover is 20 crores”
p(2) = “The total turnover is 100 crores”
p(3) = “The total expenses is 75 crores”
p(4) = “The profit turnover is 25 crores”
[Link] = p(1) & “ “ & p(2) & “ “ & p(3) & “ “ & p(4)
End Sub

Private Sub Command2_Click()


p(1) = “The sales turnover is 220 crores”
p(2) = “The total turnover is 143 crores”
p(3) = “The total expenses is 109 crores”
p(4) = “The profit turnover is 45 crores”
[Link] = p(1) & “ “ & p(2) & “ “ & p(3) & “ “ & p(4)
End Sub

Private Sub Command3_Click()


End
End Sub
Output Form:

Result :

The above program has been executed successfully and the output is verifi
Practical. No 8

EMPLOYEE DETAILS

Aim:
To Write Visual Basic Program to implement Employee Details using ADO.

Algorithm:

Step 1: Start the Process

Step 2: Start All Programs Microsoft Visual Basic 6.0


Step 3: Open the Standard EXE window.
Step 4: Click, New Project and start Designing the form.

Step 5: Design the forms and project according to the program using tools such as Label, Text
Box, Command Buttons etc., Properties and components.
Step 6: Create a database for employee details of an organization with necessary details using
MS Access.
Step 7: Establish connectivity between database table and application using ActiveX Data
Object.
Step 8: Write the code for respective tools and actions of the program using code window,
events, properties and methods.
Step 9: Save the forms, projects and Run the program.
Step 10: Check the results.
Step 11: Stop the Process.
Form Design

Coding:

Private Sub Command1_Click()


[Link]
MsgBox “This is the next record”
End Sub

Private Sub Command2_Click()


[Link]
MsgBox “This is the previous record”
End Sub

Private Sub Command3_Click()


[Link]
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
MsgBox “The record is added successfully”
End Sub

Private Sub Command4_Click()


[Link]
MsgBox “The record is deleted”
End Sub

Private Sub Command5_Click()


[Link]
MsgBox “The record is updated”
End Sub

Private Sub Command6_Click()


End
End Sub

Output Form:

Result

The above program has been executed successfully and the output is verified.
Practical. No 9

PAY SLIP

Aim:
To Write Visual Basic Program to implement pay slip for an organization by creating a database
using SQL and ADO Control.

Algorithm:
Step 1: Start the Process
Step 2: Start All Programs Microsoft Visual Basic 6.0
Step 3: Open the Standard EXE window.
Step 4: Click, New Project and start Designing the form.
Step 5: Design the forms and project according to the program using tools such as Label, Text
Box, Command Buttons etc., Properties and components.
Step 6: Create a database for pay slip of an organization with necessary details using MS Access.
Step 7: Establish connectivity between database table and application using ActiveX Data
Object.
Step 8: Write the code for respective tools and actions of the program using code window,
events, properties and methods.
Step 9: Save the forms, projects and Run the program.
Step 10: Check the results.
Step 11: Stop the Process.
Form Design

Coding:

Private Sub Command1_Click()


[Link]
MsgBox “This is the next record”
End Sub

Private Sub Command2_Click()


[Link]
MsgBox “This is the previous record”
End Sub

Private Sub Command3_Click()


[Link]
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
[Link] = “ “
MsgBox “The record is added successfully”
End Sub

Private Sub Command4_Click()


[Link]
MsgBox “The record is deleted”
End Sub

Private Sub Command5_Click()


[Link]
MsgBox “The record is updated”
End Sub

Private Sub Command6_Click()


End
End Sub

Private Sub Command7_Click()


[Link] = Val([Link]) * 10 / 100
[Link] = Val([Link]) * 12 / 100
[Link] = Val([Link]) * 5 / 100
[Link] = Val([Link]) * 5 / 100
[Link] = Val([Link]) * 2.5 / 100

[Link] = Val([Link]) + Val([Link]) + Val([Link]) + Val([Link]) +


Val([Link]) + Val([Link])
[Link] = Val([Link]) - Val([Link]) - Val([Link]) - Val([Link])

End Sub
Output Form:

Result

The above program has been executed successfully and the output is verified
Practical. No 10

BANK CUSTOMER DATABASE


Aim:
To write a VB Program to create a bank customer database by declaring simple array and
multiple arrays using ADO Control.

Algorithm:

Step 1: Start the Process


Step 2: Start All Programs Microsoft Visual Basic 6.0
Step 3: Open the Standard EXE window.
Step 4: Click New Project and Design the form.
Step 5: Design the forms and project according to the program using tools such as Rich Text
Box, Command Buttons etc., Properties and components.
Step 6: Create a database for bank customers with necessary details using MS Access.
Step 7: Establish connectivity between database table and application using ActiveX Data
Objects.
Step 8: Write the code for respective tools and actions of the program using code window,
events, properties and methods.
Step 9: Save the forms, projects and Run the program.
Step 10: Check the results.
Step 11: Stop the Process.

Form Design
Coding

Private Sub Command1_Click()


[Link]
MsgBox (“Added Successfully”)
End Sub

Private Sub Command2_Click()


p(1) = “The sales turnover is 220 crores”
p(2) = “The total turnover is 143 crores”
p(3) = “The total expenses is 109 crores”
p(4) = “The profit turnover is 45 crores”
[Link] = p(1) & “ “ & p(2) & “ “ & p(3) & “ “ & p(4)
End Sub

Private Sub Command3_Click()


End
End Sub

Output Form:

Result :
The above program has been executed successfully and the output is verified

You might also like