SEMESTER: V INDEX Batch: 2018 - 2021
VISUAL BASIC PROGRAMMING LAB
Sl. No. Date Name of the Program Page No. Staff Sign
Perform the following using VB
1 Building Simple Application for
Calculator
2 Application With Multiple Forms
3 Application With Dialogs
4 Application With Menus
5 Application Using Data Control
6 Application Using Format Dialogs
7 Drag and Drop Events
8 Creating ActiveX Control
Perform the Following Using VB as Front End and Oracle as Back End
9 Student Information System [ADODC
Connection]
Student Mark sheet Processing
10
[ADODC Connection]
11 Electricity Bill Preparation [ADODC
Connection]
12 Banking Management System
[ADODC Connection]
13 Railway Reservation System [ADODB
Connection]
Remarks: Completed____________________ Programs
Page No:
Ex No:
Date:
Creating a Simple Calculator
Page No:
Page No:
FORM 1 Coding:-
Private Sub PROCEED()
Me.Hide
Form2.Show
End Sub
Private Sub Close_Click()
End
End Sub
FORM 2 Coding:-
Dim A As Double
Dim C As Double
Dim B As String
Private Sub Command5_Click()
Text1.Text = Text1.Text + "5"
End Sub
Page No:
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
Private Sub Command0_Click()
Text1.Text = Text1.Text + "0"
End Sub
Private Sub Command00_Click()
Text1.Text = Text1.Text + "00"
End Sub
Private Sub dot_Click()
Text1.Text = Text1.Text + "."
End Sub
Private Sub backspace_Click()
Dim Z As String
If (Text1.Text = "") Then
Text1.Text = Text1.Text
Else
Z = Text1.Text
Dim L As Integer
L = Len(Z)
Text1.Text = Mid(Z, 1, L - 1)
End If
End Sub
Page No:
Private Sub plus_Click()
B = "add"
A = Val(Text1.Text)
Text1.Text = ""
End Sub
Private Sub off_Click()
Text1.Visible = False
End Sub
Private Sub minus_Click()
B = "sub"
A = Val(Text1.Text)
Text1.Text = ""
End Sub
Private Sub mul_Click()
B = "mul"
A = Val(Text1.Text)
Text1.Text = ""
End Sub
Private Sub div_Click()
B = "div"
A = Val(Text1.Text)
Text1.Text = ""
End Sub
Private Sub Close_Click()
End
End Sub
Private Sub Equalto_Click()
On Error GoTo p:
'ADD
If B = "add" Then
C = Val(Text1.Text)
Text1.Text = A + C
End If
Page No:
'SUB
If B = "sub" Then
C = Val(Text1.Text)
Text1.Text = A - C
End If
'MUL
If B = "mul" Then
C = Val(Text1.Text)
Text1.Text = A * C
End If
'DIV
If B = "div" Then
C = Val(Text1.Text)
Text1.Text = A / C
End If
Exit Sub
p:
Text1.Text = "Invalid/undefined"
End Sub
Private Sub sqrt_Click()
On Error GoTo e:
If Text1.Text = "" Then
MsgBox "enter value", vbInformation, "Alert"
Else
Text1.Text = CSng(Round(Val(Sqr(Text1.Text)), 3))
End If
Exit Sub
e:
Text1.Text = "Invalid Option"
End Sub
Private Sub Command1_Click()
Text1.Text = Text1.Text + "1"
End Sub
Page No:
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 Command0_Click()
Text1.Text = Text1.Text + "0"
End Sub
Private Sub Command00_Click()
Text1.Text = Text1.Text + "00"
End Sub
Private Sub Command1_Click()
Text1.Text = "0"
Text1.Visible = True
End Sub
Private Sub CE_Click()
Text1.Text = ""
End Sub
Private Sub AC_Click()
Text1.Text = "0"
End Sub
Page No:
Ex No:
Date :
MULTIPLE FORMS
Page No:
Page No:
Page No:
Page No:
FORM 1 Coding
Private Sub Command1_Click()
If Text1.Text = "abdul" And Text2.Text = "hakeem" Then
Form2.Show
Else
MsgBox "Unauthorised User!! Verify username or password", vbInformation,
"Caution"
End If
Me.Hide
End Sub
Private Sub Command2_Click()
End
End Sub
FORM 2 Coding
Private Sub Command1_Click()
If Form2.Option3.Value = True Then
MsgBox "Right Answer", vbInformation, "Caution"
Form3.Text1.Text = 10
Else
MsgBox "Wrong Answer"
Form3.Text1.Text = "0"
End If
Me.Hide
Form3.Show
End Sub
Private Sub Form_Load()
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
End Sub
Page No:
FORM 3 Coding
Private Sub Command1_Click()
If Form3.Option4.Value = True Then
MsgBox "Right Answer", vbInformation, "Caution"
Form4.Text1.Text = Val(Form3.Text1.Text) + 10
Else
MsgBox "Wrong Answer"
Form4.Text1.Text = Val(Form3.Text1.Text) + 0
End If
Me.Hide
Form4.Show
End Sub
Private Sub Form_Load()
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
End Sub
FORM 4 Coding
Private Sub Command1_Click()
If Form4.Option2.Value = True Then
MsgBox "Right Answer", vbInformation, "Caution"
Form5.Text1.Text = Val(Form4.Text1.Text) + 10
Else
MsgBox "Wrong Answer"
Form5.Text1.Text = Val(Form4.Text1.Text) + 0
End If
Me.Hide
Form5.Show
End Sub
Private Sub Form_Load()
Page No:
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
End Sub
FORM 5 Coding
Private Sub Command1_Click()
If Form5.Option3.Value = True Then
MsgBox "Right Answer", vbInformation, "Caution"
Form6.Text1.Text = Val(Form5.Text1.Text) + 10
Else
MsgBox "Wrong Answer"
Form6.Text1.Text = Val(Form5.Text1.Text) + 0
End If
Me.Hide
Form6.Show
End Sub
Private Sub Form_Load()
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
End Sub
FORM 6 Coding
Private Sub Command1_Click()
If Val(Text1.Text) = 0 Then
Text2.Text = "Very Poor"
ElseIf Val(Text1.Text) = 10 Then
Text2.Text = "Poor"
ElseIf Val(Text1.Text) = 20 Then
Text2.Text = "Fair"
ElseIf Val(Text1.Text) = 30 Then
Text2.Text = "GOOD"
Page No:
ElseIf Val(Text1.Text) = 40 Then
Text2.Text = "Excellent"
End If
End Sub
Private Sub Command2_Click()
Me.Hide
Form2.Show
Form2.Option1.Value = False
Form2.Option2.Value = False
Form2.Option3.Value = False
Form2.Option4.Value = False
Form3.Option1.Value = False
Form3.Option2.Value = False
Form3.Option3.Value = False
Form3.Option4.Value = False
Form4.Option1.Value = False
Form4.Option2.Value = False
Form4.Option3.Value = False
Form4.Option4.Value = False
Form5.Option1.Value = False
Form5.Option2.Value = False
Form5.Option3.Value = False
Form5.Option4.Value = False
Form6.Text1.Text = " "
Form6.Text2.Text = " "
End Sub
Private Sub Command3_Click()
End
End Sub
Page No:
Ex No: APPLICATION WITH DIALOGS
Date:
Page No:
Page No:
Page No:
FORM CODINGS :-
Dim buffer As String
Private Sub Blue_Click()
buffer = rt1.SelText
If buffer = vbNullString Then
Beep
MsgBox "please select the text!", vbCritical + vbOKOnly, "error"
Else
rt1.SelColor = vbBlue
End If
End Sub
Private Sub cmdclose_Click()
rt1.Text = " "
rt1.Visible = False
Image1.Visible = False
End Sub
Private Sub cmdimage_Click()
Image1.Visible = True
com1.ShowOpen
Image1.Picture = LoadPicture(com1.FileName)
End Sub
Private Sub copy_Click()
Clipboard.Clear
Clipboard.SetText rt1.SelText
End Sub
Page No:
Private Sub Cut_Click()
buffer = rt1.SelText
If buffer = vbNullString Then
Beep
MsgBox "please select the text!", vbCritical + vbOKOnly, "error"
Else
Clipboard.Clear
Clipboard.SetText rt1.SelText
rt1.SelText = ""
End If
End Sub
Private Sub Exit_Click()
End
End Sub
Private Sub Green_Click()
buffer = rt1.SelText
If buffer = vbNullString Then
Beep
MsgBox "please select the text!!", vbCritical + vbOKOnly, "error"
Else
rt1.SelColor = vbGreen
End If
End Sub
Page No:
Private Sub New_Click()
rt1.Visible = True
rt1.Text = vbNullString
buffer = " "
MsgBox "new file.created!", vbInformation + vbOKOnly, "new"
End Sub
Private Sub Normal_Click()
MsgBox "you have select normal", vbInformation + vbOKOnly, "normal"
rt1.Width = 11775
End Sub
Private Sub Open_Click()
rt1.Text = vbNullString
com1.ShowOpen
rt1.LoadFile (com1.FileName)
End Sub
Private Sub Paste_Click()
rt1.SelText = Clipboard.GetText
End Sub
Private Sub Red_Click()
bufer = rt1.SelText
If buffer = vbNullString Then
Beep
MsgBox "please select the text!!", vbCritical + vbOKOnly, "error"
Else
rt1.SelColor = vbRed
Page No:
End If
End Sub
Private Sub save_Click()
com1.ShowSave
rt1.SaveFile (com1.FileName)
End Sub
Private Sub Size1_Click()
MsgBox "you have selected 500", vbInformation + vbOKOnly, "500'"
rt1.Width = 5000
End Sub
Private Sub Size2_Click()
MsgBox "you have selected 700", vbInformation + vbOKOnly, "700"
rt1.Width = 7000
End Sub
Page No:
Ex No:
Date: WORKING WITH MENUS
CLICK TOOLS ~> MENU EDITOR TO CREATE MENUS
Page No:
Page No:
Page No:
FORM CODINGS :-
Dim buffer As String
Private Sub cmdclose_Click()
rt1.Text = " "
rt1.Visible = False
Image1.Visible = False
End Sub
Private Sub cmdimage_Click()
Image1.Visible = True
com1.ShowOpen
Image1.Picture = LoadPicture(com1.FileName)
End Sub
Private Sub color_Click()
com1.Flags = cd1ccfullopen
com1.ShowColor
rt1.SelColor = com1.color
End Sub
Private Sub copy_Click()
Clipboard.Clear
Clipboard.SetText rt1.SelText
End Sub
Page No:
Private Sub Cut_Click()
buffer = rt1.SelText
If buffer = vbNullString Then
Beep
MsgBox "please select the text!", vbCritical + vbOKOnly, "error"
Else
Clipboard.Clear
Clipboard.SetText rt1.SelText
rt1.SelText = ""
End If
End Sub
Private Sub Exit_Click()
End
End Sub
Private Sub font_Click()
com1.Flags = cdlCFBoth
com1.ShowFont
If com1.CancelError = True Then
Exit Sub
End If
rt1.SelFontName = com1.FontName
rt1.SelFontSize = com1.FontSize
rt1.SelBold = com1.FontBold
rt1.SelItalic = com1.FontItalic
End Sub
Page No:
Private Sub New_Click()
rt1.Visible = True
rt1.Text = vbNullString
buffer = " "
MsgBox "new file.created!", vbInformation + vbOKOnly, "new"
End Sub
Private Sub Open_Click()
rt1.Text = vbNullString
com1.ShowOpen
rt1.LoadFile (com1.FileName)
End Sub
Private Sub Paste_Click()
rt1.SelText = Clipboard.GetText
End Sub
Private Sub print_Click()
com1.Flags = cd1cfprinterfonts
com1.ShowPrinter
End Sub
Private Sub save_Click()
com1.ShowSave
rt1.SaveFile (com1.FileName)
End Sub
Page No:
Ex No:
Date : APPLICATION USING DATA CONTROL
Page No:
Page No:
Page No:
Page No:
SAVE AS DATA1
RIGHT CLICK ON PROPERTIES=>NEW TABLE
IN TABLE STRUCTURE GIVE TABLE NAME [LEARN] AND CLICK ADD
FIELD
Page No:
GIVE ALL THE REQUIRED FIELD NAMES [NAME,GENDER,EMAIL,ETC;]
Page No:
CLICK BUILD THE TABLE
DOUBLE CLICK ON TABLE NAME(LEARN)
Page No:
INSERT ALL THE DATA ONCE BY CLICKING ADD BUTTON THEN
CLOSE IT
RIGHT CLICK ON ADODC CONTROL AND SELECT ADODC PROPERTIES
AND BUILD THE TABLE USING CONNECTION STRING
SELECT DATABASE NAME, PROVIDER NAME(MS JET 4.0)
Page No:
Page No:
CLICK NEXT.THEN SELECT RECORDSOURCETAB
SELECT ALL THE FIELDS.IN PROPERTIES SET DATA SOURCE AS
ADODC1
Page No:
SELECT INDIVIDUAL FIELD AND SET DATA FIELD ACCORDINGLY
Page No:
ADD (MS GRID CONTROL6.0) FROM COMPONENTS.SET THE PROERTY
OF GRID CONTROL IN DATASOURCE AS ADODC1
Page No:
Page No:
Page No:
FORM CODING:
Private Sub cmdadd_Click()
Adodc1.Recordset.AddNew
End Sub
Private Sub cmdcancel_Click()
End
End Sub
Private Sub cmddelete_Click()
Adodc1.Recordset.Delete
End Sub
Private Sub cmdreset_Click()
txtname.Text = ""
txtgender.Text = ""
txtmail.Text = ""
txtaddress.Text = ""
txtmno.Text = ""
txtqualification.Text = ""
txtpercent.Text = ""
End Sub
Private Sub cmdupdate_Click()
Adodc1.Recordset.Update
End Sub
Page No:
Private Sub txtgender_KeyPress(KeyAscii As Integer)
Dim e As String
If KeyAscii < Asc("@") And KeyAscii > Asc("!") Then
Beep
e = MsgBox("Alphabet only", vbExclamation + vbCritical, "Alert")
KeyAscii = 0
End If
End Sub
Private Sub txtgender_LostFocus()
txtgender.Text = UCase(txtgender.Text)
If txtgender.Text = "" Then
End If
End Sub
Private Sub txtmail_LostFocus()
If InStr(txtmail, "@") = 0 Then
MsgBox "Enter E-Mail id using @symbol", vbCritical, "Alert"
txtmail.SetFocus
End If
End Sub
Private Sub txtmno_KeyPress(KeyAscii As Integer)
Dim a As String
If KeyAscii < Asc("0") And KeyAscii > Asc("9") Then
Beep
Page No:
a = MsgBox("Numeric Only", vbExclamation + vbCritical, "Alert")
KeyAscii = 0
End If
End Sub
Private Sub txtmno_LostFocus()
If Len(txtmno.Text) <> 10 Then
MsgBox "mobile number must be 10 digit", vbCritical, "Alert"
txtmno.SetFocus
End If
End Sub
Private Sub txtname_KeyPress(KeyAscii As Integer)
Dim e As String
If KeyAscii < Asc("@") And KeyAscii > Asc("!") Then
Beep
e = MsgBox("Alphabet only", vbExclamation + vbCritical, "Alert")
KeyAscii = 0
End If
End Sub
Private Sub txtname_LostFocus()
txtname.Text = UCase(txtname.Text)
If txtname.Text = "" Then
txtname.SetFocus
End If
End Sub
Page No:
Private Sub txtpercent_KeyPress(KeyAscii As Integer)
Dim e As String
If KeyAscii < Asc("0") And KeyAscii > Asc("9") Then
Beep
e = MsgBox("Numeric only", vbExclamation + vbCritical, "Alert")
KeyAscii = 0
End If
End Sub
Private Sub txtqualification_LostFocus()
txtqualification.Text = UCase(txtqualification.Text)
If txtqualification.Text = "" Then
txtqualification.SetFocus
End If
End Sub
Page No:
Ex No:
Date:
FORMAT DIALOGS
Choose Rich Text Box, Common Dialog Box and MS Internet Control from
Project =>Components
Page No:
Page No:
Page No:
FORM CODING
Dim buffer As String
Private Sub cmdclose_Click()
rt1.Text = " "
rt1.Visible = False
WebBrowser1.Visible = False
End Sub
Private Sub color_Click()
com1.Flags = cd1ccfullopen
com1.ShowColor
rt1.SelColor = com1.color
End Sub
Private Sub copy_Click()
Clipboard.Clear
Clipboard.SetText rt1.SelText
End Sub
Private Sub Cut_Click()
buffer = rt1.SelText
If buffer = vbNullString Then
Beep
MsgBox "please select the text!", vbCritical + vbOKOnly, "error"
Else
Clipboard.Clear
Page No:
Clipboard.SetText rt1.SelText
rt1.SelText = ""
End If
End Sub
Private Sub Exit_Click()
End
End Sub
Private Sub font_Click()
com1.Flags = cdlCFBoth
com1.ShowFont
If com1.CancelError = True Then
Exit Sub
End If
rt1.SelFontName = com1.FontName
rt1.SelFontSize = com1.FontSize
rt1.SelBold = com1.FontBold
rt1.SelItalic = com1.FontItalic
End Sub
Private Sub New_Click()
rt1.Visible = True
rt1.Text = vbNullString
buffer = " "
WebBrowser1.Visible = True
MsgBox "new file.created!", vbInformation + vbOKOnly, "new"
End Sub
Page No:
Private Sub Open_Click()
rt1.Text = vbNullString
com1.ShowOpen
rt1.LoadFile (com1.FileName)
WebBrowser1.Navigate com1.FileName
End Sub
Private Sub Paste_Click()
rt1.SelText = Clipboard.GetText
End Sub
Private Sub print_Click()
com1.Flags = cd1cfprinterfonts
com1.ShowPrinter
End Sub
Private Sub save_Click()
com1.ShowSave
rt1.SaveFile (com1.FileName)
End Sub
HTML CODING
<head>
<title>ample</title>
</head>
<body>
<h1>this is 1st heading</h1>
Page No:
<h2>this is 2nd heading</h2>
<h3>this is 3rd heading</h3>
<h4>this is 4th heading</h4>
<h5>this is 5th heading</h5>
<font size="20">
<Marquee>this is a marquee</marquee>
</body>
</html>
Page No:
Ex No:
Date:
Drag and Drop Events
Page No:
FORM CODING:
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
BackColor = vbRed
End Sub
Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
BackColor = vbBlue
End Sub
Page No:
Private Sub Command3_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
BackColor = vbGreen
End Sub
Private Sub Command4_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
BackColor = vbYellow
End Sub
Private Sub Command5_Click()
End
End Sub
Private Sub List1_DragDrop(Source As Control, X As Single, Y As Single)
If Source.Tag = "STRUCTS" Then
List1.AddItem Source.Caption
Else
MsgBox "This Listbox Accepts only Structured Programming"
End If
End Sub
Page No:
Private Sub List2_DragDrop(Source As Control, X As Single, Y As Single)
If Source.Tag = "OOPS" Then
List2.AddItem Source.Caption
Else
MsgBox "This Listbox Accepts only OOPS Programming"
End If
End Sub
Page No:
Ex. No:
Date : ACTIVEX CONTROL
Page No:
Then write the coding
Page No:
Now save the program as (Make project1.ocx)
Page No:
Open a new form in standard.exe
Page No:
Page No:
FORM CODINGS:
Dim a As Double
Dim c As Double
Dim b As String
Private Sub cmdac_Click()
Txt1.Text = "0"
End Sub
Private Sub Cmdback_Click()
Dim Z As String
If (Txt1.Text = "") Then
Txt1.Text = Txt1.Text
Else
Z = Txt1.Text
Dim l As Integer
l = Len(Z)
Txt1.Text = Mid(Z, 1, l - 1) ‘// (z,1,L-1)
End If
End Sub
Private Sub Cmdce_Click()
Txt1.Text = " "
End Sub
Private Sub cmdclose_Click()
End
End Sub
Page No:
Private Sub cmd00_Click()
Txt1.Text = Txt1.Text + "00"
End Sub
Private Sub Cmd0_Click()
Txt1.Text = Txt1.Text + "0"
End Sub
Private Sub Cmd1_Click()
Txt1.Text = Txt1.Text + "1"
End Sub
Private Sub Cmd2_Click()
Txt1.Text = Txt1.Text + "2"
End Sub
Private Sub Cmd3_Click()
Txt1.Text = Txt1.Text + "3"
End Sub
Private Sub Cmd4_Click()
Txt1.Text = Txt1.Text + "4"
End Sub
Private Sub Cmd5_Click()
Txt1.Text = Txt1.Text + "5"
End Sub
Page No:
Private Sub Cmd6_Click()
Txt1.Text = Txt1.Text + "6"
End Sub
Private Sub Cmd7_Click()
Txt1.Text = Txt1.Text + "7"
End Sub
Private Sub Cmd8_Click()
Txt1.Text = Txt1.Text + "8"
End Sub
Private Sub cmd9_Click()
Txt1.Text = Txt1.Text + "9"
End Sub
Private Sub cmdadd_Click()
b = "add"
a = Val(Txt1.Text)
Txt1.Text = " "
End Sub
Private Sub cmdsub_Click()
b = "sub"
a = Val(Txt1.Text)
Txt1.Text = " "
End Sub
Page No:
Private Sub cmdmul_Click()
b = "mul"
a = Val(Txt1.Text)
Txt1.Text = " "
End Sub
Private Sub cmddiv_Click()
b = "div"
a = Val(Txt1.Text)
Txt1.Text = " "
End Sub
Private Sub Cmddot_Click()
Txt1.Text = Txt1.Text + "."
End Sub
Private Sub Cmdequal_Click()
On Error GoTo p
'add
If b = "add" Then
c = Val(Txt1.Text)
Txt1.Text = a + c
End If
Page No:
'sub
If b = "sub" Then
c = Val(Txt1.Text)
Txt1.Text = a - c
End If
'mul
If b = "mul" Then
c = Val(Txt1.Text)
Txt1.Text = a * c
End If
'div
If b = "div" Then
c = Val(Txt1.Text)
Txt1.Text = a / c
End If
Exit Sub
p: Txt1.Text = "Invalid"
End Sub
Private Sub Cmdon_Click()
Txt1.Text = " "
Txt1.Visible = True
End Sub
Page No:
Private Sub Cmdoff_Click()
Txt1.Visible = False
End Sub
Private Sub cmdsqrt_Click()
On Error GoTo E:
If Txt1.Text = " " Then
MsgBox "Enter some value", vbInformation, "alert"
Else
Txt1.Text = CSng(Round(Val(Sqr(Txt1.Text)), 3))
End If
Exit Sub
E: Txt1.Text = "Invalid option"
End Sub
Page No:
Ex No:
Date:
STUDENT INFORMATION SYSTEM
Page No:
Page No:
DATA REPORT
Page No:
PROGRAM CODINGS:
Private Sub Command1_Click()
Text11.Text = Val(Text9.Text) - Val(Text10.Text)
End Sub
Private Sub DELTES_Click()
Adodc1.Recordset.Delete
MsgBox "RECORD DELETED SUCCESSFULLY"
End Sub
Private Sub EXITS_Click()
Adodc1.Recordset.exit
End Sub
Private Sub FIRSTS_Click()
Adodc1.Recordset.MoveFirst
End Sub
Private Sub INSERTS_Click()
Adodc1.Recordset.AddNew
End Sub
Private Sub LASTS_Click()
Adodc1.Recordset.MoveLast
End Sub
Page No:
Private Sub NEWS_Click()
Adodc1.Recordset.AddNew
End Sub
Private Sub NEXTS_Click()
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
MsgBox "Final Records Reached"
Adodc1.Recordset.MoveFirst
Private Sub PREVIOUSS_Click()
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveLast
End Sub
Private Sub SAVES_Click()
Adodc1.Recordset.Save
MsgBox "Your Record Updated Successfully"
End Sub
Private Sub UPDATES_Click()
Adodc1.Recordset.Update
MsgBox "RECORD UPDATED SUCCESSFULLY"
End Sub
Page No:
Private Sub NEW_CLICK()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
End Sub
Page No:
Ex No:
Date :
STUDENT MARKSHEET PROCESSING SYSTEM
Page No:
Page No:
DATA REPORT
Page No:
PROGRAM CODING:
Private Sub Exits_Click()
End
End Sub
Private Sub Movefirsts_Click()
Adodc1.Recordset.MoveFirst
End Sub
Private Sub Movelasts_Click()
Adodc1.Recordset.MoveLast
End Sub
Private Sub News_Click()
Adodc1.Recordset.AddNew
End Sub
Private Sub Nexts_Click()
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
MsgBox "Last record Reached"
Adodc1.Recordset.MoveLast
End If
End Sub
Page No:
Private Sub Previouss_Click()
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
MsgBox "First Record Reached"
Adodc1.Recordset.MoveFirst
End Sub
Private Sub Saves_Click()
Adodc1.Recordset.Update
MsgBox "Records is Saved"
End Sub
Private Sub modify()
Dim a, b, c, d, e As Integer
a = Val(Text4.Text)
b = Val(Text5.Text)
c = Val(Text6.Text)
d = Val(Text7.Text)
e = Val(Text8.Text)
Text9.Text = a + b + c + d + e
Text10.Text = Val(Text9.Text) / 5
If (a >= 40) And (b >= 40) And (c >= 40) And (d >= 40) And (e >= 40) Then
Text11.Text = "PASS"
If Val(Text10.Text) >= 75 Then
Page No:
Text12.Text = "DISTINCTION"
ElseIf Val(Text10.Text) >= 60 Then
Text12.Text = "FIRST"
ElseIf Val(Text10.Text) >= 50 Then
Text12.Text = "SECOND"
ElseIf Val(Text10.Text) >= 40 Then
Text12.Text = "THIRD"
End If
Else
Text11.Text = "FAIL"
Text12.Text = "NIL"
End If
End Sub
Private Sub Text4_Change()
modify
End Sub
Private Sub Text5_Change()
modify
End Sub
Private Sub Text6_Change()
modify
End Sub
Page No:
Private Sub Text7_Change()
modify
End Sub
Private Sub Text8_Change()
modify
End Sub
Page No:
Ex No:
Date :
Electricity Bill Preparation System
Page No:
Update:
Page No:
DATA REPORT
Page No:
PROGRAM CODINGS:
Private Sub Command1_Click()
If Val(Text4.Text) > Val(Text3.Text) Then
Text5.Text = Val(Text4.Text) - Val(Text3.Text)
Else
MsgBox "current reading should be greater then pervious reading!!"
End If
If (Text5.Text >= 100) And (Text5.Text <= 200) Then
Text6.Text = Val(Text5.Text) * 10
ElseIf (Text5.Text > 200) And (Text5.Text <= 400) Then
Text6.Text = Val(Text.Text) * 20
ElseIf (Text5.Text > 400) And (Text5.Text <= 600) Then
Text6.Text = Val(Text5.Text) * 40
Else
Text6.Text = Val(Text5.Text) * 75
End If
End Sub
Private Sub EXIT_Click()
End
End Sub
Private Sub FIRST_Click()
Adodc1.Recordset.MoveFirst
End Sub
Page No:
Private Sub LAST_Click()
Adodc1.Recordset.MoveLast
End Sub
Private Sub NEW_Click()
Adodc1.Recordset.AddNew
End Sub
Private Sub NEXT_Click()
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
MsgBox "Last record Reached"
Adodc1.Recordset.MoveLast
End If
End Sub
Private Sub PREVIOUS_Click()
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
MsgBox "Last record reached"
Adodc1.Recordset.MoveFirst
End If
End Sub
Private Sub SAVE_Click()
Adodc1.Recordset.SAVE
MsgBox "record updates"
End Sub
Page No:
Ex No:
Date:
BANKING MANAGEMENT SYSTEM
Page No:
Page No:
Page No:
Page No:
Page No:
FORM CODINGS:
Private Sub Command1_Click()
If Text1.Text = "abdul" And Text2.Text = "hakeem" Then
Me.Hide
Form2.Show
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command1_Click()
Form3.Show
End Sub
Private Sub Command2_Click()
Form4.Show
End Sub
Private Sub Command3_Click()
Form5.Show
End Sub
Page No:
Private Sub Command1_Click()
Adodc1.Recordset.AddNew
End Sub
Private Sub Command2_Click()
Adodc1.Recordset.Update
End Sub
Private Sub Command3_Click()
Adodc1.Recordset.Delete
End Sub
Private Sub Command4_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
Private Sub Command1_Click()
Adodc1.Recordset.AddNew
MsgBox "Amount Received Successfully"
End Sub
Page No:
Private Sub Text1_Click()
Text1.Text = Format$(Date, "dd-mm-yyyy")
End Sub
Private Sub Command1_Click()
Adodc1.Recordset.AddNew
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub Text1_Click ()
Text1.Text = Format$(Date, "dd-mm-yyyy")
End Sub
Page No:
Ex No:
Date : RAILWAY RESERVATION SYSTEM
Form 1(Train Details form):
Page No:
Form 2 (Passenger Details form):
Page No:
To Add a New Record:
Page No:
To Update a Record:
Page No:
Data Environment 1:
Page No:
Data Report 1:
Page No:
Data Environment 2:
Page No:
Data Report 2:
Page No:
Program Codlings:
FORM 1:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
MENU EDITOR:
Private Sub ADD_Click()
clear
rs.AddNew
End Sub
Private Sub DELETE_Click()
rs.DELETE
rs.MOVEFIRST
display
MsgBox "Record deleted"
End Sub
Private Sub EXIT_Click()
End
End Sub
Private Sub MOVEFIRST_Click()
rs.MOVEFIRST
display
End Sub
Page No:
Program Codlings:
Private Sub MOVELAST_Click()
rs.MOVELAST
display
End Sub
Private Sub NEXT_Click()
rs.MoveNext
display
End Sub
Private Sub PREVIOUS_Click()
rs.MovePrevious
display
End Sub
Private Sub SAVE_Click()
rs.Fields(0) = Trim(Text1)
rs.Fields(1) = Trim(Text2)
rs.Fields(2) = Trim(Text3)
rs.Fields(3) = Trim(Text4)
rs.Fields(4) = Trim(Text5)
rs.Update
MsgBox "RECORD UPDATED"
End Sub
Page No:
CALCULATION:
Private Sub Command1_Click()
Form2.Show
End Sub
FRONT PAGE:
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "Provider=MSDAORA.1;Password=hakeem;User ID=3bca71;Data
Source=cahccl;Persist Security Info=True"
rs.Open "train", cn, adOpenDynamic, adLockOptimistic
clear
display
End Sub
Sub display()
Text1 = rs.Fields(0)
Text2 = rs.Fields(1)
Text3 = rs.Fields(2)
Text4 = rs.Fields(3)
Text5 = rs.Fields(4)
End Sub
Page No:
Sub clear()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
End Sub
FORM 2:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Private Sub Command2_Click()
Text7.Text = Val(Text5.Text) * Val(Text6.Text)
End Sub
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "Provider=MSDAORA.1;Password=hakeem;User ID=3bca71;Data
Source=cahccl;Persist Security Info=True"
rs.Open "passenger1", cn, adOpenDynamic, adLockOptimistic
clear
display
End Sub
Page No:
Sub display()
Text1 = rs.Fields(0)
Text2 = rs.Fields(1)
Text3 = rs.Fields(2)
Text4 = rs.Fields(3)
Text5 = rs.Fields(4)
Text6 = rs.Fields(5)
Text7 = rs.Fields(6)
End Sub
Sub clear()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
End Sub
SQL Codings:
SQL>create table train(train varchar(20),trainname varchar(20),pnrno
varchar(20),source varchar(20),destination varchar(20));
Table created.
SQL> insert into train values('kk5678','doronto','15454','chennai','bangalore');
1 row created.
Page No:
TRAIN TRAINNAME PNRNO SOURCE DESTINATION
------------------------------------------------------------------------------------------------
kk5678 doronto 15454 chennai bangalore
tt4521 shatabthi 25792 delhi hyderabad