You are required to create an application for the BestMed race to assist in racers to register. The racer should type in their name, select a race type and enter their age. The racer should then be added to a listbox.The race types are as follows: 5Km 10Km 42.5Km The following rules apply when adding a participant to a race: If a racer is over the age of 65 they can only participate in the 5km race Each race can only have a maximum of 10 participants (Hint – Use global variable to keep track of number of participants) You should also ensure that the number of participants for the selected race does not exceed ten, if it does then you should display a messageBox informing the user that the race is full. I dont know how to limit the participants. What I have tried: <pre lang="c#"><pre> private void btnAddToRace_Click(object sender, EventArgs e) { // declare variables and assign values string name = txtName.Text; string RaceType = cbxRaceType.Text; int age; // get users age age = Convert.ToInt32(txtAge.Text); if(age >= 65 && cbxRaceType.Text != "5 Km") //ensure participants aged 65 only enters for 5Km { MessageBox.Show("You can only register for the 5Km race, beacuase you are 65 or older"); } else { lstRace.Items.Add(name + RaceType + "Race"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)