Visual Basic 6 Visual Basic 6 Practical Solutions Practical Solutions for for T.Y.B.Sc.(I.T.) 2009 - 2010 T.Y.B.Sc.(I.T.) 2009 - 2010 Guided by – Hon. Prof. Mr. Vahid Kapadia Compiled by – Sibtain Masih Student of I.T. Department, AP College, Grant Road, Mumbai – 400 008
48
Embed
19014796 TY BscIT 10 VB Practical Solution 20092010
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Compiled by – Sibtain MasihStudent of I.T. Department,AP College,Grant Road,Mumbai – 400 008
Q.1. Create a project for Coffee Shop?
Form Design-
Code-
Option ExplicitDim mcurSubTotal As CurrencyDim mcurTotal As CurrencyDim mcurGrandTotal As CurrencyDim mintCustomerCount As Integer
Private Sub cmdCalculate_Click()Dim curPrice As CurrencyDim intQuantity As IntegerDim curTax As CurrencyDim curItemAmount As Currency
Const curTaxRate = 0.08Const curCappuccinoPrice As Currency = 2Const curExpressoPrice As Currency = 2.25Const curLattePrice As Currency = 1.75Const curIcedPrice As Currency = 2.5
If optCappuccino.Value = True Then curPrice = curCappuccinoPriceElseIf optEspresso.Value = True Then curPrice = curExpressoPriceElseIf optLatte.Value = True Then curPrice = curLattePriceElseIf optIcedCappuccino.Value = True Or optIcedLatte.Value = True Then curPrice = curIcedPriceEnd If
If IsNumeric(txtQuantity) Then intQuantity = Val(txtQuantity) curItemAmount = curPrice * intQuantity mcurSubTotal = mcurSubTotal + curItemAmount If chkTax.Value = vbChecked Then curTax = mcurSubTotal * curTaxRate End If mcurTotal = mcurSubTotal + curTax lblItemAmount = FormatCurrency(curItemAmount) lblSubTotal = FormatNumber(mcurSubTotal) lblTax = FormatNumber(curTax) lblTotal = FormatCurrency(mcurTotal)Else
MsgBox "Quantity must be numeric.", vbExclamation, "Numeric Test Failed" txtQuantity = Empty txtQuantity.SetFocusEnd IfEnd Sub
Private Sub cmdClear_Click() If mcurSubTotal <> 0 Then 'Clear only if calculation made optCappuccino.Value = True optEspresso.Value = False optLatte.Value = False optIcedCappuccino.Value = False optIcedLatte.Value = False lblItemAmount = Empty chkTax.Enabled = False 'Allow change for new order only With txtQuantity .Text = Empty .SetFocus End With Else MsgBox "No New Order to Clear.", vbExclamation, "Customer Order" End IfEnd Sub
Private Sub cmdExit_Click()EndEnd Sub
Private Sub cmdNewOrder_Click()'Clear the current order and add to totals cmdClear_Click lblSubTotal = Empty lblTax = Empty lblTotal = Empty 'Add to totals If mcurSubTotal <> 0 Then 'Should not be able add to counts if no new order/customer 'Preven accidential clicking mcurGrandTotal = mcurGrandTotal + mcurTotal mcurSubTotal = 0 mcurTotal = 0 'Reset for next customer mintCustomerCount = mintCustomerCount + 1 End If
'Display appropriate display item and enable check box With chkTax .Enabled = True .Value = vbChecked End WithEnd Sub
Private Sub cmdSummary_Click() 'Calculate the avrage and display total Dim curAvg As Currency Dim strMsg As String Dim strFormattedAvg As String If mintCustomerCount > 0 Then If mcurTotal <> 0 Then cmdNewOrder_Click 'Make sure last order is counted curAvg = mcurGrandTotal / mintCustomerCount 'Format the numbers strFormattedAvg = FormatCurrency(curAvg) 'Concatenate the message string strMsg = "Orders: " & mintCustomerCount & vbCrLf & "Average Sale: " & strFormattedAvg MsgBox strMsg, vbInformation, "Coffee Sale Summary" End If Else MsgBox "No data to summarize.", vbExclamation, "Coffee Sale Summary" End IfEnd Sub
Screen Shot-
Q.2. Create a project to read the income and calculate Income Tax, Surcharge and Net income. Where Income Tax isIncome TaxFirst 1,00,000 NilNext 1,00,000 10%Next 50,000 20%Next 50,000 30%Excess 35%Surcharge=5% of Income Tax if income is greater than 500000?
Form Design-
Code-
Private Sub cmdCalculate_Click()Dim mIncome As Currency, mTax As Currency, mSurcharge As Currency
Private Sub cmdClear_Click()txtIncome = EmptytxtTax = EmptytxtSurcharge = EmptytxtNetIncome = EmptytxtIncome.SetFocusEnd Sub
Private Sub cmdExit_Click()EndEnd Sub
Private Sub txtIncome_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Then 'Do Nothing Else KeyAscii = 0 End If End Sub
Screen Shot-
Q.3. Create a project to read the marks of I, II, III and IV semester of B.Sc.(I.T.) students and calculate total and average?
Form Design-
Code-
Private Sub cmdOK_Click() frmSemMarks.Hide frmResult.Show frmResult.txtTotal = Val(frmSemMarks.txt1) + Val(frmSemMarks.txt2) + Val(frmSemMarks.txt3) + Val(frmSemMarks.txt4) + Val(frmSemMarks.txt5) frmResult.txtAverage = Val(frmResult.txtTotal) / 5 End Sub
Private Sub Form_Activate()txt1.SetFocusEnd Sub
Private Sub txt1_KeyPress(KeyAscii As Integer)KeyAscii = checkVal(KeyAscii)End Sub
Private Sub txt2_KeyPress(KeyAscii As Integer)KeyAscii = checkVal(KeyAscii)End Sub
Private Sub txt3_KeyPress(KeyAscii As Integer)KeyAscii = checkVal(KeyAscii)End Sub
Private Sub txt4_KeyPress(KeyAscii As Integer)KeyAscii = checkVal(KeyAscii)End Sub
Private Sub txt5_KeyPress(KeyAscii As Integer)KeyAscii = checkVal(KeyAscii)End SubPublic Function checkVal(Ascii As Integer) As Integer If (Ascii >= 48 And Ascii <= 57) Or (Ascii = 8) Then checkVal = Ascii Else checkVal = 0 End IfEnd Function
Screen Shots-
Q.4. Create a project to cover different properties of combo box and list box?
Form Design-
Code-
Private Sub cmdAddToCombo_Click()If (cbo1.Text = Empty) Then MsgBox "Enter Text in the Combo box text field !", vbOKOnly, "Error"Else If (MsgBox("Do you want to add " + cbo1.Text + " to the combo box?", vbYesNo, "Add to Combo") = vbYes) Then cbo1.AddItem (cbo1.Text)End IfEnd Sub
Private Sub cmdAddToList_Click()If (MsgBox("Do you want to add " + cbo1.Text + " to the list box?", vbYesNo, "Add to List") = vbYes) Then lst1.AddItem (cbo1.List(cbo1.ListIndex))End Sub
Private Sub cmdClearList_Click()If lst1.ListCount = 0 Then MsgBox "No item in the list", vbOKOnly, "Clear List"Else lst1.Clear MsgBox "List cleared!", vbOKOnly, "Clear List"End IfEnd Sub
Private Sub cmdCount_Click()MsgBox "Total Items in the list are : " & Str(lst1.ListCount)End Sub
Private Sub cmdExit_Click()EndEnd Sub
Private Sub cmdRemoveItem_Click()If (MsgBox("Do you want to remove " + lst1.Text + " from the list box?", vbYesNo, "Remove Item") = vbYes) Then lst1.RemoveItem (lst1.ListIndex)End Sub
Private Sub Form_Load()lst1.Clear
cbo1.AddItem "Apple"cbo1.AddItem "Mango"cbo1.AddItem "Grapes"cbo1.AddItem "Banana"End Sub
Screen Shot-
Q.5. Create a project to maintain form no, name, percentage, maths marks and category of students in a random file. Create a user defined type for maintaining the details. Allow the user to ADD, MOODIFY and DELETE details. Use a list box to display the name of the student to the user. Provide a SHOW button to display all the details in text boxes after selecting the name from the list?
Form Design-
Code-
Option Explicit Private Type Student curFormNo As Currency strName As String * 10 curPercentage As Currency curMathsMarks As Currency strCategory As String * 5 End Type Dim mudtStudent As Student
Private Sub cmdAdd_Click() With mudtStudent .curFormNo = Val(txtFormNo)
.strName = lstName.List(lstName.ListIndex) .curPercentage = Val(txtPercentage) .curMathsMarks = Val(txtMathsMarks) .strCategory = txtCategory End With Put #1, lstName.ListIndex + 1, mudtStudentEnd Sub
Private Sub cmdDelete_Click() Dim i As Integer i = lstName.ListIndex + 1 Get #1, i, mudtStudent For i = 1 To 5 If Trim(mudtStudent.strName) = Trim(lstName.List(lstName.ListIndex)) Then txtFormNo = mudtStudent.curFormNo txtPercentage = mudtStudent.curPercentage txtMathsMarks = mudtStudent.curMathsMarks txtCategory = mudtStudent.strCategory If (MsgBox("Do you want to DELETE the record?", vbYesNo, "Reply") = vbYes) Then With mudtStudent .curFormNo = 0 .strName = Empty .curPercentage = 0 .curMathsMarks = 0 .strCategory = Empty End With Put #1, lstName.ListIndex + 1, mudtStudent Else Exit For End If End If Next iEnd Sub
Private Sub cmdExit_Click() EndEnd Sub
Private Sub cmdModify_Click() With mudtStudent .curFormNo = Val(txtFormNo)
.strName = lstName.List(lstName.ListIndex) .curPercentage = Val(txtPercentage) .curMathsMarks = Val(txtMathsMarks) .strCategory = txtCategory End With Put #1, lstName.ListIndex + 1, mudtStudentEnd Sub
Private Sub cmdShow_Click() Dim i As Integer For i = 1 To 5 Get #1, i, mudtStudent If Trim(mudtStudent.strName) = Trim(lstName.List(lstName.ListIndex)) Then txtFormNo = mudtStudent.curFormNo txtPercentage = mudtStudent.curPercentage txtMathsMarks = mudtStudent.curMathsMarks txtCategory = mudtStudent.strCategory End If Next i End Sub
Private Sub Form_Load() lstName.AddItem ("Raj") lstName.AddItem ("Vikas") lstName.AddItem ("Ali") lstName.AddItem ("Ravi") lstName.AddItem ("John") Open "f:\student.txt" For Random As #1 Len = Len(mudtStudent)End Sub
Private Sub Form_Terminate() Close #1End Sub
Screen Shots-
Q.6. Create a project to read 20 numbers and print its median?
Form Design-
Code-
Dim x(20) As Integer, cnt As Integer
Private Sub cmdExit_Click() EndEnd Sub
Private Sub cmdNext_Click() x(cnt) = Val(txtNumber) txtNumber = Empty txtNumber.SetFocus cnt = cnt + 1 If cnt = 20 Then Dim temp, i, j As Integer For i = 0 To 18 For j = i + 1 To 19 If x(j) < x(i) Then temp = x(i) x(i) = x(j) x(j) = temp End If Next j Next i MsgBox "Median is - " & (x(9) + x(10)) / 2, vbOKOnly, "Median" cnt = 0 lblNumber.Caption = "Enter Number " & cnt + 1 Else lblNumber.Caption = "Enter Number " & cnt + 1 End IfEnd Sub
Private Sub Form_Load() lblNumber.Caption = "Enter Number " & cnt + 1End Sub
Screen Shot-
Q.7. Create a project for KBC game show through database?
Form Design-
Code-
Option ExplicitDim mintCounter As IntegerDim mcurAmount As CurrencyDim mcurPrizeAmoutn As CurrencyDim intQuestionNumber As Integer, intRandom As Integer, i As IntegerDim strName As String, strNum As StringDim mintarrQuestionNumber(15) As Integer
Private Sub cmdExit_Click()EndEnd Sub
Private Sub cmd5050_Click()If MsgBox("Do you want to use LifeLine 50-50 ?", vbYesNo + vbQuestion, "KBC III") = vbYes Then If (lblOptA = lblAnswer) Or (lblOptB = lblAnswer) Then optC.Visible = False optD.Visible = False
lblOptC.Visible = False lblOptD.Visible = False Else optA.Visible = False optB.Visible = False lblOptA.Visible = False lblOptB.Visible = False End If cmd5050.Visible = FalseEnd IfEnd Sub
Private Sub cmdEndGame_Click()EndEnd Sub
Private Sub cmdJantaKiRai_Click() 'This is for not coded yet.End Sub
Private Sub cmdLock_Click()If (MsgBox("Are you sure ?", vbYesNo + vbQuestion, "KBC III") = vbYes) Then If optA.Value = True Then AnswerCheck (lblOptA) ElseIf optB.Value = True Then AnswerCheck (lblOptB) ElseIf optC.Value = True Then AnswerCheck (lblOptC) ElseIf optD.Value = True Then AnswerCheck (lblOptD) Else MsgBox "Select an option !", vbOKOnly + vbCritical, "Error" End If End IfEnd Sub
Private Sub cmdNext_Click()With optA .Value = False .Visible = True .Enabled = TrueEnd With
With optB .Value = False
.Visible = True .Enabled = TrueEnd With
With optC .Value = False .Visible = True .Enabled = TrueEnd With
With optD .Value = False .Visible = True .Enabled = TrueEnd With
cmdLock.Enabled = TruemintCounter = mintCounter + 1If mintCounter = 14 Then MsgBox "Final Question for 1 Crore - Are You Ready !!!", vbOKOnly + vbInformation, "KBC III"End If
Public Sub SetPreviousQuestionColor()Select Case mintCounter Case 1 lbl1.ForeColor = vbBlack Case 2 lbl2.ForeColor = vbBlack Case 3 lbl3.ForeColor = vbBlack Case 4 lbl4.ForeColor = vbBlack Case 5 lbl5.ForeColor = vbBlack Case 6 lbl6.ForeColor = vbBlack Case 7 lbl7.ForeColor = vbBlack Case 8 lbl8.ForeColor = vbBlack Case 9 lbl9.ForeColor = vbBlack Case 10 lbl10.ForeColor = vbBlack Case 11 lbl11.ForeColor = vbBlack Case 12 lbl12.ForeColor = vbBlack Case 13 lbl13.ForeColor = vbBlack Case 14 lbl14.ForeColor = vbBlackEnd SelectEnd Sub
Private Sub optA_Click()cmdWithDraw.Enabled = FalseEnd Sub
Private Sub optB_Click()cmdWithDraw.Enabled = FalseEnd Sub
Private Sub optC_Click()cmdWithDraw.Enabled = FalseEnd Sub
Private Sub optD_Click()cmdWithDraw.Enabled = FalseEnd Sub
Public Sub SetQuestion()mintarrQuestionNumber(0) = 0
If mintCounter <> 0 Then intRandom = Rnd * 34 i = 0 While i < mintCounter If (mintarrQuestionNumber(i) = intRandom) Then intRandom = Rnd * 15 i = 0 Else i = i + 1 End If Wend mintarrQuestionNumber(mintCounter) = intRandom While (Val(lblQNo) <> intRandom) If (Data1.Recordset.EOF = True) Then Data1.Recordset.MoveFirst Else Data1.Recordset.MoveNext End If WendEnd IfEnd Sub
Screen Shot-
Q.8. Create a project to process electricity bill by inputting consumer number, consumer name, address, current meter reading, previous meter reading, bill number and bill date. It should calculate total units consumed, gross amount, fuel charges, electricity duty, service tax and net amount. A deposit of Rs.500/- for commercial and Rs.200 for residential is to be added to bill amount. The rate applicable is
Units Consumed Residential CommercialUp to 200 units Rs.0.5/unit Rs.3/unitNext 300 Rs.2/unit Rs.5/unitNext 300 Rs.5/unit Rs.10/unitExcess Rs.10/unit Rs.25/unit
Fuel charge is 10.5% of gross amount, electricity duty is 5% of gross amount plus fuel charges, service tax is 2.6% of gross amount plus fuel charges plus electricity duty and net amount is gross amount + fuel charges + electricity duty + service tax.Display first due date after one month from bill date.Display second due date after two months from bill date with interest 12% added.Display third due date after three months from bill date with interest 24%.Provide facility for bill printing?
Form Design-
Code-
Option ExplicitDim mCurMeterReading As Integer, mPrevMeterReading As Integer, mUnitsConsumed As Integer, mDeposit As IntegerDim mElectricityCharge As Double, mGrossAmt As Double, mFuelCharges As Double, mElectricityDuty As Double, mServiceCharge As Double, mNetAmt As Double, mNetAmtAfter1mMonth As Double, mNetAmtAfter2mMonths As Double, mNetAmtAfter3mMonths As DoubleDim mDate As DatePrivate Sub cmdCalculate_Click() mCurMeterReading = Val(txtCurrentMeterReading) mPrevMeterReading = Val(txtPreviousMeterReading) mUnitsConsumed = mCurMeterReading - mPrevMeterReading If cboConsumerType.ListIndex = 0 Then mDeposit = 100 If mUnitsConsumed <= 200 Then mElectricityCharge = mUnitsConsumed * 0.5 ElseIf mUnitsConsumed <= 500 Then mElectricityCharge = 200 * 0.5 + (mUnitsConsumed - 200) * 2 ElseIf mUnitsConsumed <= 800 Then mElectricityCharge = 200 * 0.5 + 300 * 2 + (mUnitsConsumed - 500) * 5 Else mElectricityCharge = 200 * 0.5 + 300 * 2 + 300 * 5 + (mUnitsConsumed - 800) * 10 End If ElseIf cboConsumerType.ListIndex = 1 Then mDeposit = 500 If mUnitsConsumed <= 200 Then mElectricityCharge = mUnitsConsumed * 3 ElseIf mUnitsConsumed <= 500 Then mElectricityCharge = 200 * 3 + (mUnitsConsumed - 200) * 5 ElseIf mUnitsConsumed <= 800 Then mElectricityCharge = 200 * 3 + 300 * 5 + (mUnitsConsumed - 500) * 10 Else mElectricityCharge = 200 * 3 + 300 * 5 + 300 * 10 + (mUnitsConsumed - 800) * 25 End If End If mGrossAmt = mDeposit + mElectricityCharge
Private Function NumCheck(Asc As Integer) As Integer If (Asc >= 48 And Asc <= 57) Or Asc = 8 Then NumCheck = Asc Else NumCheck = 0 End IfEnd Function
Private Function CharCheck(Asc As Integer) As Integer If (Asc >= 65 And Asc <= 90) Or (Asc >= 97 And Asc <= 122) Or Asc = 8 Or Asc = 32 Then CharCheck = Asc Else CharCheck = 0 End IfEnd Function
Private Sub cmdPrint_Click()PrintFormEnd Sub
Private Sub txtBillNumber_KeyPress(KeyAscii As Integer) KeyAscii = NumCheck(KeyAscii)End Sub
Private Sub txtConsumerNo_KeyPress(KeyAscii As Integer) KeyAscii = NumCheck(KeyAscii)End Sub
Private Sub txtCurrentMeterReading_KeyPress(KeyAscii As Integer)KeyAscii = NumCheck(KeyAscii)End Sub
Private Sub txtDate_KeyPress(KeyAscii As Integer)KeyAscii = DateCheck(KeyAscii)
End Sub
Private Sub txtName_KeyPress(KeyAscii As Integer) KeyAscii = CharCheck(KeyAscii)
End Sub
Private Sub txtPreviousMeterReading_KeyPress(KeyAscii As Integer) KeyAscii = NumCheck(KeyAscii)End Sub
Private Function DateCheck(Asc As Integer) As Integer If (Asc >= 47 And Asc <= 57) Or Asc = 8 Then DateCheck = Asc Else DateCheck = 0 End IfEnd Function
Screen Shot-
Q.9. Create a project to read matrix A(x,y) and matrix B(p,q). Calculate and print matrix Result. Display matrix subscript while inputting and printing. Check if matrix multiplication is possible. If not then display appropriate message?
Form Design-
Code-
Option ExplicitDim matrixA(10, 10) As Integer, matrixB(10, 10) As Integer, matrixC(10, 10)Dim intRowA As Integer, intColA As Integer, intRowB As Integer, intColB As Integer, i As Integer, j As Integer, k As Integer, m As Integer
Private Sub cmdAddition_Click()If intRowA = intRowB And intColA = intColB Then For i = 0 To intRowA - 1 For j = 0 To intColA - 1 matrixC(i, j) = (matrixA(i, j) + matrixB(i, j)) Next Next Call showmatrixC(i, j)Else MsgBox "Addition Can not be performed.", vbOKOnly, "Error"End IfEnd Sub
Private Sub cmdExit_Click()EndEnd Sub
Private Sub cmdMultiplication_Click()If intColA = intRowB Then For i = 0 To intRowA - 1 For j = 0 To intColB - 1 For k = 0 To intColA - 1 matrixC(i, j) = matrixC(i, j) + matrixA(i, k) * matrixB(k, j) Next Next Next Call showmatrixC(i, j)Else MsgBox "Multiplication Can not be performed.", vbOKOnly, "Error"End IfEnd Sub
Private Sub cmdOKElementA_Click()matrixA(i, j) = txtElementAIf i = txtRowA - 1 And j = txtColA - 1 Then cmdOKElementA.Enabled = False txtElementA.Enabled = False lblMatrixA.Caption = "Elements of Matrix A - " + vbNewLine + vbNewLine For i = 0 To txtRowA - 1
For j = 0 To txtColA - 1 lblMatrixA.Caption = lblMatrixA.Caption & matrixA(i, j) & " " Next lblMatrixA.Caption = lblMatrixA.Caption + vbNewLine + vbNewLine Next lblMatrixBTitle.Visible = True lblRowB.Visible = True lblColB.Visible = True lblSizeOfB.Visible = True txtRowB.Visible = True txtColB.Visible = True cmdOKSizeB.Visible = True txtRowB.SetFocus i = 0 j = 0Else If j = txtColA - 1 Then i = i + 1 j = 0 Else j = j + 1 End If lblElementA.Caption = "Enter element (" & i + 1 & ", " & j + 1 & ")" txtElementA = Empty txtElementA.SetFocusEnd IfEnd Sub
Private Sub cmdOKElementB_Click()matrixB(i, j) = txtElementBIf i = txtRowB - 1 And j = txtColB - 1 Then cmdOKElementB.Enabled = False txtElementB.Enabled = False lblMatrixB.Visible = True lblMatrixB.Caption = "Elements of Matrix B - " + vbNewLine + vbNewLine For i = 0 To txtRowB - 1 For j = 0 To txtColB - 1 lblMatrixB.Caption = lblMatrixB.Caption & matrixB(i, j) & " " Next lblMatrixB.Caption = lblMatrixB.Caption + vbNewLine + vbNewLine Next fraSelectOperation.Visible = True cmdAddition.Visible = True cmdSubstraction.Visible = True cmdMultiplication.Visible = True i = 0
j = 0Else If j = txtColB - 1 Then i = i + 1 j = 0 Else j = j + 1 End If lblElementB.Caption = "Enter element (" & i + 1 & ", " & j + 1 & ")" txtElementB = Empty txtElementB.SetFocusEnd IfEnd Sub
Private Sub cmdSubstraction_Click()If intRowA = intRowB And intColA = intColB Then For i = 0 To intRowA - 1 For j = 0 To intColA - 1 matrixC(i, j) = (matrixA(i, j) - matrixB(i, j)) Next Next Call showmatrixC(i, j)Else MsgBox "Substraction Can not be performed.", vbOKOnly, "Error"End IfEnd Sub
Public Function showmatrixC(row As Integer, col As Integer)lblResult = EmptyFor i = 0 To row - 1 For j = 0 To col - 1 lblResult = lblResult & "(" & i + 1 & "," & j + 1 & ") " lblResult = lblResult & matrixC(i, j) & " " Next lblResult = lblResult + vbNewLine + vbNewLineNextFor i = 0 To row - 1 For j = 0 To col - 1 matrixC(i, j) = 0 NextNextEnd Function
Private Sub Form_Load()i = 0j = 0End Sub
Screen Shot-
Q.10. The local library has a summary reading program. The staff keeps a chart of reading name and bonus points earned. Create a project using a menu and function procedure that will determine the bonus points.
&File Menu-&points-&sumarry-&exit
&Edit Menu-&clear-&font-&color
&Help-&About
Use text boxes to obtain the readers name and number of books read. Use a label to display the number of bonus points. The point’s menu command should call a function procedure to calculate the points using this schedule.The first 3 books are worth 10 points each.The next 3 books are worth 15 points each.All books over 6 are worth 20 points each.The summary menu command displays the average number of books read for all readers of that session.The clear menu command clears the name, no. of books read and the bonus points and then reset the focus.The color and font menu command change the color and font of information displayed in the bonus point label.Use a message box to displayed your name as a programmer for the about option on the help menu?
Form Design-
Code-
Dim mintBonusPoints As Integer, mintBooks, mintReaders
Private Sub Form_Load()mintReaders = 0mintBooks = 0End Sub
Private Sub mnuAbout_Click()MsgBox "Designed by Sibtain Masih !", vbOKOnly + vbInformation, "Library"End Sub
Private Sub mnuClear_Click()txtName = EmptytxtBooksRead = EmptylblBonusPoints = EmptytxtName.SetFocusEnd Sub
Private Sub mnuColor_Click() cdbDialog.ShowColor lblBonusPoints.ForeColor = cdbDialog.ColorEnd Sub