Page 444 - Computer Software Application TP - Volume 1
P. 444
COMPUTER SOFTWARE APPLICATION - CITS
• The values from text boxes (txtid, txtname, txtbp, txtded) are assigned to respective variables (eid,
ename, bp, ded).
• Dearness Allowance (da) is calculated as 107% of the Basic Pay (bp) and stored in the da variable.
• House Rent Allowance (hra) is calculated as 25% of the Basic Pay (bp) and stored in the hra variable.
• Total Salary (ts) is calculated as the sum of Basic Pay (bp), Dearness Allowance (da), and House Rent
Allowance (hra) and displayed in the txtts textbox.
• Net Salary (ns) is calculated as the Total Salary (ts) minus Deductions (ded) and displayed in the txtns
textbox.
3 Worksheet Cell Values:
• The lines setting values in Cells(2, 1) through Cells(2, 8) are meant to label the columns in the worksheet.
These cells are likely the headers for the data being entered or calculated.
4 Displaying Calculated Values:
• The calculated values for Dearness Allowance (da) and House Rent Allowance (hra) are displayed in
text boxes txtda and txthra respectively. However, these text boxes are not shown in the provided code
snippet.
Overall, this code snippet captures the process of calculating and displaying employee salary details based on
input provided through a user interface. It seems to be designed to work with Excel VBA given the references to
cells and text boxes.
Private Sub cmdsubmit_Click()
Dim row As Long
‘Make Sheet4 active
Sheet4.Activate
‘Determine emptyRow
row = WorksheetFunction.CountA(Range(“A:A”)) + 1
Cells(row, 1).Value = txtid.Value
Cells(row, 2).Value = txtname.Value
Cells(row, 3).Value = txtbp.Value
Cells(row, 4).Value = txtda.Value
Cells(row, 5).Value = txthra.Value
Cells(row, 6).Value = txtded.Value
Cells(row, 7).Value = txtts.Value
Cells(row, 8).Value = txtns.Value
End Sub
This VBA code is associated with the click event of a button named cmdsubmit. Here’s what the code does:
1 Variable Declaration:
• row As Long: Declares a variable named row as a Long data type. This variable will be used to determine
the row where the new data will be entered.
2 Activating Sheet4:
• Sheet4.Activate: This line makes sure that Sheet4 is the active sheet where the data will be entered.
429
CITS : IT & ITES - Computer Software Application - Exercise 71