Hello.
That's the name of the program I probably should have started C# with. Instead, I've built a small application that identifies musical keys from individual notes through the application of falsification offsets from identified notes.
The program works, but I've got a dozen tickbox methods that all do exactly the same thing save for
1. A single numerical value which informs the offset falsifier method
2. The name of the checkbox control, which is used to link the boolean value of the truthtable to the checkbox value, and provide forward and backwards functionality (i.e., it sets true on check, and false on uncheck).
There has to be a better way to do this. Ideally, I'd be able to parameterize the control name, and the passed num value. Even more ideally, I would be able to handle all of the tickboxes with a single method, with the linked values bound to the control state rather than repeating myself a dozen times.
Or, just as likely, there is some solution that simply escapes my imagination.
The values in question are highlighted below.
Your input is appreciated.
-
-
-
- private void CTick_CheckedChanged(object sender, EventArgs e)
- {
- byte num = 0;
- Roots[num] = CTick.Checked;
- KillMaj();
- DisplayKeys();
- }
-
-
- private void CSharpTick_CheckedChanged(object sender, EventArgs e)
- {
- byte num = 1;
- Roots[num] = CSharpTick.Checked;
- KillMaj();
- DisplayKeys();
- }
-
- private void DTick_CheckedChanged(object sender, EventArgs e)
- {
- byte num = 2;
- Roots[num] = DTick.Checked;
- KillMaj();
- DisplayKeys();
- }
-
- [... you get the idea]