Write a Visual Basic Program to make customer Survey and with their name and then display the survey result.
------------------------------------------------------------------------------------------
Design Window:-
First Form :-
Second form:-
Code;-
Dim Excellent As Integer
Dim Satisfactory As Integer
Dim Average As Integer
Dim Bad As Integer
Dim Total As Integer
Private Sub cmdContinue_Click()
If optExcellent.Value Then
Excellent = Excellent + 1
ElseIf optSatisfactory.Value Then
Satisfactory = Satisfactory + 1
ElseIf optAverage.Value Then
Average = Average + 1
Else
Bad = Bad + 1
End If
txtName.Text = ""
optExcellent.Value = False
optSatisfactory.Value = False
optAverage.Value = False
optBad.Value = False
txtName.SetFocus
End Sub
Private Sub cmdQuit_Click()
Total = Excellent + Satisfactory + Average + Bad
With frmServeyResult
.lblExcellent = Excellent
.lblSatisfactory = Satisfactory
.lblAverage = Average
.lblBad = Bad
.lblExcellentPer = Format((Excellent / Total) * 100, "#0.00")
.lblSatisfactoryPer = Format((Satisfactory / Total) * 100, "#0.00")
.lblAveragePer = Format((Average / Total) * 100, "#0.00")
.lblBadPer = Format((Bad / Total) * 100, "#0.00")
End With
frmServeyResult.Show
Unload Me
End Sub
========================================
OUTPUT
After entry of six customers response of first form survey result is:-
------------------------------------------------------------------------------------------
Design Window:-
First Form :-
Second form:-
Code;-
Dim Excellent As Integer
Dim Satisfactory As Integer
Dim Average As Integer
Dim Bad As Integer
Dim Total As Integer
Private Sub cmdContinue_Click()
If optExcellent.Value Then
Excellent = Excellent + 1
ElseIf optSatisfactory.Value Then
Satisfactory = Satisfactory + 1
ElseIf optAverage.Value Then
Average = Average + 1
Else
Bad = Bad + 1
End If
txtName.Text = ""
optExcellent.Value = False
optSatisfactory.Value = False
optAverage.Value = False
optBad.Value = False
txtName.SetFocus
End Sub
Private Sub cmdQuit_Click()
Total = Excellent + Satisfactory + Average + Bad
With frmServeyResult
.lblExcellent = Excellent
.lblSatisfactory = Satisfactory
.lblAverage = Average
.lblBad = Bad
.lblExcellentPer = Format((Excellent / Total) * 100, "#0.00")
.lblSatisfactoryPer = Format((Satisfactory / Total) * 100, "#0.00")
.lblAveragePer = Format((Average / Total) * 100, "#0.00")
.lblBadPer = Format((Bad / Total) * 100, "#0.00")
End With
frmServeyResult.Show
Unload Me
End Sub
========================================
OUTPUT
After entry of six customers response of first form survey result is:-