0% found this document useful (0 votes)
57 views27 pages

Null 1

The document outlines a semester 6 programming in VB course. It includes 10 topics: 1) building a simple arithmetic calculator, 2) writing programs using loops and decision making to generate Fibonacci series, find sums, and display in triangle format, 3) creating a menu and MDI forms, 4) building a simple input screen to read and write to a file, 5) displaying files using controls, 6) illustrating common dialog controls to open, edit, and save text files, 7) developing a windows installation with registration and login forms connected to a database, 8) inserting, updating, and deleting records from a database, 9) implementing a personal information system using MDI, controls and reports, 10) implementing animation using

Uploaded by

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

Null 1

The document outlines a semester 6 programming in VB course. It includes 10 topics: 1) building a simple arithmetic calculator, 2) writing programs using loops and decision making to generate Fibonacci series, find sums, and display in triangle format, 3) creating a menu and MDI forms, 4) building a simple input screen to read and write to a file, 5) displaying files using controls, 6) illustrating common dialog controls to open, edit, and save text files, 7) developing a windows installation with registration and login forms connected to a database, 8) inserting, updating, and deleting records from a database, 9) implementing a personal information system using MDI, controls and reports, 10) implementing animation using

Uploaded by

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

BCA

SEMESTER VI
PROGRAMMING IN VB
1. Construction of an Arithmetic Calculator (Simple)
2. Writing simple programs using loops and decision making statements.
a. Generate Fibonacci series.

b. Find the sum of N numbers.


c. To display the numbers/symbols in triangle format.
3. Write a program to create a menu and MDI Forms.
4. Write a program to create a simple input screen with four basic controls to read input and
write it to a file.

5. Write a program to display files in a directory using DriveListBox, DirListBox


and FileListBox control and open, edit and save text file using Rich text box
control
6. Write a program to illustrate Common Dialog Control and to open, edit and save text file
7. Write a program to develop windows based installation file with Student Registration
form and Login form using database access.
8. Develop a program to Insert, update, delete a Record in database usingADO
9. Write a program to implement Personal Information System using MDI and
Standard ADODC controls and reports.
10. Write a program to implement animation using timers.
1.SIMPLE ARITHMETIC CALCULATOR

AIM:
To perform arithmetic operation using a simple calculator function in visual basic.
ALGORITHM:
STEP1: Start the program
STEP2: Design the application with necessary label box, text box and command box.
STEP3: To change the command button names give 1,2,3---0 and +,-,*,=
STEP4: Write the necessary coding to each other buttons.
STEP5: Get the first value and receive the which operation to perform.
STEP6: Get the second value and and press the assignment symbol
STEP7: Run the application and display the result.
STEP8: Stop the program
PROGRAM:

Dim x as Integer
Dim y as String
Private sub command1_click()
Text1.text=Text1.text+ ”1”
End sub

Private sub command10_click()


Text1.text=Text1.text+ ”0”
End sub

Private sub command11_click()


X=text1.t
Y=”+”
Text1.text=” ”
End sub

Private sub command12_click()


X=text1.text
Y=”-”
Text1.text=” ”
End sub

Private sub command13_click()


X=text1.text
Y=”*”
Text1.text=” ”
End sub

Private sub command14_click()


X=text1.text
Y=”/”
Text1.text=” ”
End sub

Private sub command15_click()


If y=” + “ then
Text1.text=val(x) + val(text1.text)
End if
If y=” - “ then
Text1.text=val(x) - val(text1.text)
End if
If y=” * “ then
Text1.text=val(x) * val(text1.text)
End if
If y=” / “ then
Text1.text=val(x) / val(text1.text)
End if
End sub
Private sub command16_click()
Text1.text=” ”
End sub

Private sub command2_click()


Text1.text=Text1.text+ ”2”
End sub

Private sub command3_click()


Text1.text=Text1.text+ ”3”
End sub

Private sub command4_click()


Text1.text=Text1.text+ ”4”
End sub

Private sub command5_click()


Text1.text=Text1.text+ ”5”
End sub

Private sub command6_click()


Text1.text=Text1.text+ ”6”
End sub

Private sub command7_click()


Text1.text=Text1.text+ ”7”
End sub

Private sub command8_click()


Text1.text=Text1.text+ ”8”
End sub

Private sub command9_click()


Text1.text=Text1.text+ ”9”
End sub

OUTPUT:
RESULT:

Thus the above program Simple arithmetic calculator is successfully executed.


2 (A): FIBONACCI SERIES

AIM:
To Generate Fibonacci series using for loop

PROCEDURE:

1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project Dialog Box and
click open.
2. Create textboxes to get the Fibonacci series.
3. Create command button Fibonacci series.
4. Double click on the buttons and write code to print the Fibonacci series
5. Display the output in the form.
6. Save and Press F5 to execute the application.

CODING:-
Private Sub Command1_Click ( )

Dim x, g, n, i, sum As Integer


n = Val(Text1.Text)
x=0
y=1
Print x
Print y

For i = 3 To n
sum = x + y
Print sum
x=y
y = sum
y = sum
Next i
End Sub
OUT PUT DESIGN

2 (B): SUM OF N NUMBERS

AIM:
To find the sum of N numbers Using loop

PROCEDURE:

1. Open Visual Basic 6.0 IDE, Select Standard Exe from the
New Project Dialog Box and click open.
2. Create textboxes to get the sum of N numbers
3. Create command button sum of N numbers
4. Double click on the buttons and write code to print the sum of
N numbers
5. Display the output in the form.
6. Save and Press F5 to execute the application.
CODING:-
Private Sub Command1_Click()
Dim n, i, s As Integer
Cls
n = Val(Text1.Text)
For i = 1 To n
s=s+i
Next i
Print "Sum of N Number = "; s
End Sub

OUT PUT DESIGN

2 (C):TRIANGLE FORMAT
AIM:
To display the numbers/symbols in triangle format

PROCEDURE:
1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project Dialog Box and click
open.
2. Create display the numbers/symbols in triangle format
3. Create command button display the numbers/symbols in triangle format
4. Double click on the buttons and write code to print the display the numbers/symbols
in triangle format
5. Display the output in the form.
6. Save and Press F5 to execute the application
CODING:-
Private Sub Command1_Click()
Dim i, n As Integer
n = Val(InputBox("Enter Number of rows"))
For i = 1 To n
Print Space(n - i) + String(i, ("*"))
Next i
End Sub

OUTPUT DESIGN:

RESULT:
Thus the above program has been executed successfully.
3 WRITE A PROGRAM TO CREATE A MENU AND MDI FORMS

AIM:
To create a menu and MDI Forms

PROCEDURE:
1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project Dialog Box and
click open.
2. Right click the project explorer click add and choose MDI form
3. Right click form and click menu editor
4. give the names for menus and write the code
5. Display the output in the form.
6. Save and Press F5 to execute the application
MDI FORM CODING:
Private Sub EXIT_Click()
End
End Sub
Private Sub OPEN_Click()
Form1.Show
End Sub
FORM CODING:
Private Sub C_Click()
MDIForm1.Show
End Sub
OUTPUT DESIGN:

RESULT:
Thus the above program has been executed successfully.
4. WRITE A PROGRAM TO CREATE A SIMPLE INPUT SCREEN WITH
FOUR BASIC CONTROLS TO READ INPUT AND WRITE IT TO A FILE.

AIM:
To create a simple input screen with four basic controls to read input and write it to a file

PROCEDURE:
1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project Dialog Box and
click open.
2. Create Option boxes to display the gender
3. Create command button display the gender in textbox
4. Double click on the buttons and write code to print the display the gender
5. Display the output in the form.
6. Save and Press F5 to execute the application

CODING:

Private Sub DISPLAY_Click()


If Option1.Value = True Then
MsgBox"MR."& Text1.Text
Else
MsgBox"MRS."& Text1.Text
End If
OUTPUT:

RESULT:
Thus the above program has been executed successfully.
5. WRITE A PROGRAM TO DISPLAY FILES IN A DIRECTORY USING
DRIVELISTBOX, DIRLISTBOX AND FILELISTBOX CONTROL

AIM:

To display files in a directory using DriveListBox, DirListBox and FileListBox control

PROCEDURE:
1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project Dialog Box and
click open.
2. Create and write code to Dir, drive,file list boxes to display the file and rich text box
3. Create command button to save the file
4. Double click on the buttons and write code to print the saved file
5. Display the output in the form.
6. Save and Press F5 to execute the application

CODING:-

DirListBox, DriveListBox, FileListBox, RichtextBOx


Private Sub Command1_Click()
RichTextBox1.LoadFile (File1.Path + File1.FileName)
End Sub

Private Sub Command2_Click()


RichTextBox1.SaveFile File1.Path + File1.FileName, rtfRTF
MsgBox ("File Saved !!!")
RichTextBox1.Text = ""
End Sub

Private Sub Dir1_Change()


File1.Path = Dir1.Path
End Sub

Private Sub Drive1_Change()


Dir1.Path = Drive1.Drive
End Sub
OUTPUT :

RESULT:
Thus the above program executed success fully.
6. WRITE A PROGRAM TO ILLUSTRATE COMMON DIALOG
CONTROL AND TO OPEN, EDIT AND SAVE TEXT FILE

AIM:

To illustrate Common Dialog Control and to open, edit and save text file.
PROCEDURE:
1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project Dialog Box and
click open.
2. Create and TEXT box
3. Create command button to save, open,edit the file
4. Double click on the buttons and write code to print the saved file
5. Display the output in the form.
6. Save and Press F5 to execute the application

CODING:-

Private Sub Command1_Click()


cd1.ShowSave
End Sub

Private Sub
cd1.ShowOpen
End Sub

Private Sub save_Click()


cd1.ShowSave
End Sub
OUTPUT:

RESULT:

Thus the above program has been executed successfully.


7. WRITE A PROGRAM TO DEVELOP WINDOWS BASED
INSTALLATION FILE WITH STUDENT REGISTRATION FORM
AND
LOGIN FORM USING DATABASE ACCESS.

AIM:

To develop windows based installation file with Student Registration form and
Login form using database access.

PROCEDURE:
1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project Dialog Box and
click open.
2. Open 2 forms and create form design for login and registration
3. Create command buttons for both forms and place the data control
4. Create the database for registration form
4. Double click on the buttons and write code to print the saved file and change data
properties on property form
5. Display the output in the form.
6. Save and Press F5 to execute the application

LOGIN FORM:

Private sub addnew_Click()


Data1.recordsource.addnew
Text1.setfocus
End Sub

Private sub previous_Click()


Data1.recordset.moveprevious
End Sub

Private sub save_Click()


Data1.recordset.update
End Sub

Private sub next_Click()


Data1.recordset.movenext
End Sub

Private sub delete_Click()


Data1.recordset.delete
End Sub

Private sub exit_Click()


end
End Sub

OUTPUT:

RESULT:
Thus the above program has been executed successfully.
8. DEVELOP A PROGRAM TO INSERT, UPDATE, DELETE A RECORD
IN DATABASE USING ADO

AIM:
To develop a program to insert, update, delete a Record in database using ADO

PROCEDURE:

1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project Dialog Box and
click open.
2. Open forms and create form design for Student details
3. Create command buttons for forms and place the ADO data control
4. Create the database for registration form
4. Double click on the buttons and write code to Insert, Update, Delete file and change
data properties on property form
5. Display the output in the form.
6. Save and Press F5 to execute the application

CODING:-

Private Sub ADDNEW_Click()


Text1.SetFocus
Adodc1.Recordset.ADDNEW
MsgBox"RECORD HAS BEEN ADDED"
End Sub
Private Sub AVG_GotFocus()
AVG = Val(TOTAL) / 6
End Sub
Private Sub DELETE_Click()
Confirm = MsgBox("Are you sure you want to delete this record?", vbYesNo, "Deletion
Confirmation")
If Confirm = vbYes Then
Adodc1.Recordset.DELETE
MsgBox"Record Deleted!", ,"Message"
Else
MsgBox"Record Not Deleted!", ,"Message"
End If
End Sub
Private Sub EXIT_Click()
Unload Me
End Sub
Private Sub GRADE_GotFocus()
If AVG > 90 And RESULT.Text = "pass" Then
GRADE.Text = "o grade'"
Else
If AVG > 75 And RESULT.Text = "pass" Then
GRADE.Text = "a grade'"
Else
If AVG > 60 And RESULT.Text = "pass" Then
GRADE.Text = "b grade'"
Else
If AVG > 40 And RESULT.Text = "pass" Then
GRADE.Text = "c grade'"
Else
GRADE.Text = "d grade'"
End If
End If
End If
End If
End Sub
Private Sub RESULT_GotFocus()
If Val(Text6.Text) >= 40 And Val(Text7.Text) >= 40 And Val(Text8.Text) >= 40 And
Val(Text9.Text) >= 40 And Val(Text10.Text) >= 40 And Val(Text11.Text) >= 40 Then
RESULT = "pass"
Else
RESULT = "fail"
End If
End Sub

Private Sub SAVE_Click()


Adodc1.Recordset.Fields("NAME") = Text1.Text
Adodc1.Recordset.Fields("REGNO") = Text2.Text
Adodc1.Recordset.Fields("DEPT") = Text3.Text
Adodc1.Recordset.Fields("BATCH") = Text5.Text
Adodc1.Recordset.Fields("DOB") = Text4.Text
Adodc1.Recordset.Fields("VB") = Text6Text
Adodc1.Recordset.Fields("OS") = Text7.Text
Adodc1.Recordset.Fields("SE") = Text8.Text
Adodc1.Recordset.Fields("CN") = Text9.Text
Adodc1.Recordset.Fields("MSA") = Text10.Text
Adodc1.Recordset.Fields("SS") = Text11.Text
Adodc1.Recordset.Update
MsgBox"RECORD IS UPDTAED SUCCESSFULLY"
End Sub

Private Sub TOTAL_GotFocus()


TOTAL = Val(Text6) + Val(Text7) + Val(Text8) + Val(Text9) + Val(Text10) + Val(Text11)
End Sub
OUTPUT:-

RESULT:
Thus the above program has been executed successfully.
9 WRITE A PROGRAM TO IMPLEMENT PERSONAL INFORMATION
SYSTEM USING MDI AND STANDARD ADODC CONTROLS AND
REPORTS.

AIM:
To develop write a program to implement Personal Information System using MDI and
Standard ADODC controls and reports

PROCEDURE:

1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project Dialog Box and
click open.
2. Open form and create form design for Personal Information Systems details
3. Create command buttons for forms and place the ADODC data control and MDI form
4. Create the database for Personal Information System
5. Create a new MS access database

6.Click Add button in wizard, Select Microsoft Ms Access driver, Click finish
7. Give Data Source Name and select the database which is already saved and click ok.
8. Double click on the buttons and write the cod change data properties on property
form 9.. Display the output in the form.
10. Save and Press F5 to execute the application

CODING:-
Private Sub PIS_Click()
Form1.Show
Me. Hide
End Sub
RESULT:
Thus the above program has been executed successfully.
10. WRITE A PROGRAM TO IMPLEMENT ANIMATION USING TIMERS.

AIM:
To implement animation using timers

PROCEDURE:
1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project Dialog Box and
click open.
2. Place the timer and give the intrevel 1
3. Create command button to move the image and stop the image
4. Double click on the buttons and write code to print the saved file
5. Display the output in the form.
6. Save and Press F5 to execute the application

CODING:-

Private Sub Command1_Click()


Timer1.Enabled = True
End Sub

Private Sub Command2_Click()


Timer1.Enabled = False
End Sub

Private Sub Form_Load()


Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()


Image1.Left = Image1.Left + 10
If Image1.Left >= 2600 Then
Image1.Top = Image1.Top - 10
Image1.Left = Image1.Left + 10
End If
End Sub
OUT PUT:

RESULT:
Thus the above program has been executed successfully.

You might also like