I am so lost on how to get this code to work, and I am pretty sure what I have is all wrong.
The problem is as follows:
Each salesperson is assigned a 4 character ID, with the first character either an F (full-time) or a P (part-time). And the last character is either a 1 (sells new cars) or a 2 (sells used cars).
I need to create an application that allows the sales manager to enter a ID and the number of cars the salesperson sold during the month. The app should all the sales manager to enter this info for as many salespeople as he likes. The app needs to calculate and display the total number of cars sold by each of the following: full-time employees, part-time employees, employees that sell new cars and employees that sell used cars.
I have the following code which works so to speak, but it doesn't total the amounts of cars sold if more than one salesperson ID is entered. And in general I think what works in this code, just works, but isn't actually correct.
Private Sub calcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calcButton.Click ' Define Variables Dim id As String = String.Empty id = salesIDTextBox.Text.ToUpper If id.StartsWith("F") And id.EndsWith("1") Then noFulltimeLabel.Text = carsSoldTextBox.Text noNewCarLabel.Text = carsSoldTextBox.Text ElseIf id.StartsWith("F") And id.EndsWith("2") Then noFulltimeLabel.Text = carsSoldTextBox.Text noUsedCarLabel.Text = carsSoldTextBox.Text ElseIf id.StartsWith("P") And id.EndsWith("1") Then noParttimeLabel.Text = carsSoldTextBox.Text noNewCarLabel.Text = carsSoldTextBox.Text ElseIf id.StartsWith("P") And id.EndsWith("2") Then noParttimeLabel.Text = carsSoldTextBox.Text noUsedCarLabel.Text = carsSoldTextBox.Text Else MessageBox.Show("Incorrect employee ID number. ID must begin with F or P and end with 1 or 2.", _ "BobCat Motors", MessageBoxButtons.OK, _ MessageBoxIcon.Information) End If salesIDTextBox.Focus()
Honestly, I don't know where to begin. Any help would be appreciated.