I have an assignment to make a program for Time Entry. I am trying to get it where the Get payment button is disabled when the program first executes and then enables once I have submitted hours for five days. Below is the code I have so far and any help would be greatly appreciated!
Public Class TimeEntry
Private Sub submitButton_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles submitButton.Click
If hoursTextBox.Text <> String.Empty Then
recordsListBox.Items.Add(hoursTextBox.Text)
hoursTextBox.Clear()
End If
hoursTextBox.Focus()
End Sub
Private Sub getButton_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles getButton.Click
Dim total As Integer
Dim hoursCounter As Integer
Dim hours As Integer
total = 0
hoursCounter = 0
hours = 0
Do While hoursCounter <= 5
hoursCounter = recordsListBox.Items(hoursCounter)
total += hours
hoursCounter += 1
Loop
If hoursCounter < 0 Then
paymentLabel.Text = "No hours were entered!"
ElseIf hoursCounter < 21 Then
paymentLabel.Text = String.Format("{0:F}", hoursCounter * 10)
ElseIf hoursCounter < 31 Then
paymentLabel.Text = String.Format("{0:F}", hoursCounter * 12)
ElseIf hoursCounter < 41 Then
paymentLabel.Text = String.Format("{0:F}", hoursCounter * 12)
Else
paymentLabel.Text = "Too many hours were entered!"
End If
End Sub
Private Sub clearButton_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles clearButton.Click
recordsListBox.Items.Clear()
paymentLabel.Text = String.Empty
submitButton.Enabled = True
getButton.Enabled = False
hoursTextBox.Focus()
End Sub
End Class