Professional Documents
Culture Documents
Assignment For Programming in Visual Basic: B.Sc. (General) PART-III Examination - 2019
Assignment For Programming in Visual Basic: B.Sc. (General) PART-III Examination - 2019
INDEX
Sl No. Program Page No.
02 Create a project for a company which accept Emp No., Emp name,
Salary by text boxes, sex should be selected either M or F, the
allowances HRA will be 20% of salary and DA will be 10% of salary and
these should be calculated automatically and displayed in the
respective boxes. When OK button is pressed a confirmation message
should be displayed. Make a heading also.
Project No: 01
Create a project using On Error Resume Next Statement, get a number and divide that
number by zero so that an error message should be displayed (Division by Zero is
Undefined)
Object View:
Program Code:
Private Sub Command1_Click()
Dim a, b, c As Double
a = Text1.Text
b = Text2.Text
c=a/b
Label5.Caption = FormatNumber(c, 2)
done:
Exit Sub
P age |4
cmnt:
End Sub
Text1.Text = ""
Text2.Text = ""
Label5.Caption = ""
End Sub
Unload Me
End Sub
Form:
P age |5
Outputs:
i)
ii)
P age |6
Project No: 02
Create a project for a company which accept Emp No., Emp name, Salary by text boxes,
sex should be selected either M or F, the allowances HRA will be 20% of salary and DA
will be 10% of salary and these should be calculated automatically and displayed in the
respective boxes. When OK button is pressed a confirmation message should be
displayed. Make a heading also.
Object View:
Program Code:
Private Sub Command1_Click()
no = Text1.Text
name = Text2.Text
sal = Text3.Text
da = sal * 10 / 100
P age |7
Text5.Text = hra
Text6.Text = da
MsgBox "Emp No: " & no & "; Name: " & name & vbCrLf & "Salary: " & sal & "; Sex: " &
Text4.Text & vbCrLf & "HRA: " & hra & vbCrLf & "DA: " & da
End Sub
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Option1.Value = False
Option2.Value = False
End Sub
Text4.Text = "Female"
End Sub
Text4.Text = "Male"
End Sub
End
End Sub
Form:
Outputs:
i)
P age |9
ii)
P a g e | 10
Project No: 03
Create a project to display Fibonacci series.
Object View:
Program Code:
Private Sub Command1_Click()
Dim A, B, C, N As Integer
N = Val(Text1.Text)
A=0
B=1
If N <= 0 Then
ElseIf N = 1 Then
Label4.Caption = A
Else
For I = 2 To N - 1
C=A+B
A=B
B=C
Next I
End If
End Sub
Text1.Text = ""
Label4.Caption = ""
End Sub
End
End Sub
Form:
P a g e | 12
Output:
i)
ii)
iii)
P a g e | 13
Project No: 04
Object View:
Program Code:
Private Sub Command1_Click()
x = Val(Text1.Text)
far = 9 / 5 * x + 32
Calc.Caption = far
Label2.Caption = "C"
Label3.Caption = "F"
End If
cen = 5 / 9 * (x - 32)
Calc.Caption = cen
Label2.Caption = "F"
Label3.Caption = "C"
End If
End Sub
Text1.Text = ""
Calc.Caption = ""
Label2.Caption = ""
Label3.Caption = ""
End Sub
End
End Sub
Form:
P a g e | 15
Output:
i)
ii)
P a g e | 16
Project No: 05
Create a project to find the sum of numbers from 1 to selected value.
Object View:
Program Code:
Private Sub Command1_Click()
X = Val(Text1.Text)
Y=1
SUM = 0
Do While Y <= X
SUM = SUM + Y
Y=Y+1
Loop
Label2.Caption = SUM
P a g e | 17
End Sub
Text1.Text = ""
Label2.Caption = ""
End Sub
End
End Sub
Form:
P a g e | 18
Output:
i)
ii)
P a g e | 19
Project No: 06
Create a project to find the simple interest.
Object View:
Program Code:
Private Sub Command1_Click()
Dim P, R, T, SI As Double
P = Val(Text1.Text)
R = Val(Text2.Text)
T = Val(Text3.Text)
SI = P * R * T / 100
Label2.Caption = SI
End Sub
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Label2.Caption = ""
End Sub
End
End Sub
Form:
P a g e | 21
Output:
i)
ii)
P a g e | 22
Project No: 07
Create a project to make a calculator.
Object View:
Program Code:
Dim op As Integer
End Sub
End Sub
End Sub
End Sub
End Sub
End Sub
End Sub
End Sub
End Sub
P a g e | 24
End Sub
End Sub
per = Label2.Caption
fn = Label2.Caption
End Sub
op = 2
fn = Label2.Caption
Label2.Caption = ""
End Sub
op = 3
fn = Label2.Caption
Label2.Caption = ""
End Sub
P a g e | 25
op = 4
fn = Label2.Caption
Label2.Caption = ""
End Sub
op = 1
fn = Label2.Caption
Label2.Caption = ""
End Sub
If op = 1 Then
ElseIf op = 2 Then
ElseIf op = 3 Then
ElseIf op = 4 Then
End If
End Sub
Label2.Caption = ""
P a g e | 26
End Sub
Unload Me
End Sub
Form:
Output:
Multiplied by 5
Output
P a g e | 28
Project No: 08
Create a project to convert a text from uppercase to lowercase and vice versa.
Object View:
Program Code:
Private Sub Command1_Click()
Label1.Caption = LCase(Text1.Text)
Label1.Caption = UCase(Text1.Text)
End If
End Sub
Text1.Text = ""
Label1.Caption = ""
End Sub
Unload Me
End Sub
Form:
P a g e | 30
Output:
i)
Upper to lower
ii)
Lower to upper
P a g e | 31
Project No: 09
Create a project to make a gradation (like A, B, C, D and E) based on total marks
providing the marks of different subjects.
Object View:
Program Code:
Private Sub Command1_Click()
Eng = Val(Text2.Text)
Phys = Val(Text3.Text)
Math = Val(Text4.Text)
Cms = Val(Text5.Text)
Chem = Val(Text6.Text)
Label_fm.Caption = 500
Avj = Val(Label_total.Caption) / 5
Label_total.Caption = ""
Label_grade.Caption = ""
MsgBox "A candidate can't obtain more than 100 marks in a subject"
Label_grade = "A"
Label_grade = "B"
Label_grade = "C"
Label_grade = "D"
Label_grade = "E"
Label_grade = "F"
End If
End Sub
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
P a g e | 33
Text6.Text = ""
Label_fm.Caption = ""
Label_total.Caption = ""
Label_grade.Caption = ""
End Sub
Unload Me
End Sub
Form:
P a g e | 34
Output:
i)
ii)
iii)