Question: I have question in Visual Basic about Gross Pay. I have the code but I want to change the result to display in LIST BOX
I have question in Visual Basic about Gross Pay. I have the code but I want to change the result to display in LIST BOX This is my code
Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click ' Declare variables Dim intHours As Integer ' Hours worked Dim decPayRate As Decimal ' Hourly Pay Rate Dim decGrossPay As Decimal ' Gross Pay lblStatus.Text = String.Empty
' Get the hours worked. If Integer.TryParse(txtHours.Text, intHours) Then ' Get the hourly pay rate. If Decimal.TryParse(txtPayRate.Text, decPayRate) Then ' Calculate the gross pay. decGrossPay = intHours * decPayRate
' Display the gross pay. lstGroosPay.Text = decGrossPay.ToString("c") Else ' Display pay rate error message. lblStatus.Text = "Enter a valid value for hourly pay rate." End If Else ' Display hours worked error message. lblStatus.Text = "Enter a valid integer for hours worked." End If End Sub
For the output in LISTBOX. It Should be include Hours Worked: Pay Rate: $$ Dollars/hours Hours Gross Pay ______________________ 1 $$ 2 $$ 3 $$ 4 $$ 5 $$ Total Pay: $$

Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
