VB - Practical Programs
VB - Practical Programs
Sl. No. Date Name of the Program Page No. Staff Sign
Perform the Following Using VB as Front End and Oracle as Back End
Ex No:
Date:
Creating a Simple Calculator
Page No:
Page No:
FORM 1 Coding:-
FORM 2 Coding:-
Dim A As Double
Dim C As Double
Dim B As String
'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
MULTIPLE FORMS
Page No:
Page No:
Page No:
Page No:
FORM 1 Coding
FORM 2 Coding
FORM 3 Coding
End Sub
FORM 4 Coding
FORM 5 Coding
FORM 6 Coding
Text2.Text = "Fair"
ElseIf Val(Text1.Text) = 30 Then
Text2.Text = "GOOD"
Page No:
Date:
Page No:
Page No:
Page No:
FORM CODINGS :-
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
FORM CODINGS :-
Dim buffer As String
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
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:
FORM CODING:
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
BackColor = vbRed
End Sub
'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
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
Date :
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
Date:
FORM CODINGS:
Ex No:
rs.DELETE
rs.MOVEFIRST
display
End Sub
End
End Sub
Form2.Show
End Sub
FRONT PAGE:
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
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:
Table created.
1 row created.
Page No:
------------------------------------------------------------------------------------------------