CONTEXT
I'm creating a program for the football games today that will track wins/losses. We have 10 individuals that have predicted which team will win/lose for all the games today. I have it set up as:
ex.) Florida State vs. Florida [ ] Florida [ ]FSU
LOGIC
I created a "Family" class that contains a string name, int score, and string gamePrediction1 through 29 games. Each 10 family members are added to a _familyPredictions list which is ran through upon a checkbox being clicked. When a checkbox is checked:
if (chkFloridaState.Checked == true)
{
foreach (Family f in _familyPredictions)
{
if (f.game4 == "Florida State") { f.score++; chkFlorida.Enabled = false; }
}
setScores();
}
PROBLEM
This currently works but I'd have to recreate this method for each and every checkbox. Is there a Case/Switch I could use or an overall method that could operate as a "master" method instead of having to create it for each checkbox?
Thanks!
Aucun commentaire:
Enregistrer un commentaire