hello guys,I am making a simple application for college and if somebody could advice me how to handle many radiobuttons cause I think I am making too much of copy-paste (C# beginner) , the wpf design isn't finished.
So whenever user changes one of his degrees (college subjects) that automatically Average and Sum variables are being updated, but the problem is cause i need to make that 6x times for 6x semesters.
//code below is only for one row to check which button is selected
public int dohvatiocjenu(RadioButton rb1, RadioButton rb2, RadioButton rb3, RadioButton rb4, RadioButton rb5)
{
if ((bool)rb1.IsChecked) return 1;
else if ((bool)rb2.IsChecked) return 2;
else if ((bool)rb3.IsChecked) return 3;
else if ((bool)rb4.IsChecked) return 4;
else if ((bool)rb5.IsChecked) return 5;
else return 0;
}
So whenever user changes one of his degrees (college subjects) that automatically Average and Sum variables are being updated, but the problem is cause i need to make that 6x times for 6x semesters.
//code below is only for one row to check which button is selected
public int dohvatiocjenu(RadioButton rb1, RadioButton rb2, RadioButton rb3, RadioButton rb4, RadioButton rb5)
{
if ((bool)rb1.IsChecked) return 1;
else if ((bool)rb2.IsChecked) return 2;
else if ((bool)rb3.IsChecked) return 3;
else if ((bool)rb4.IsChecked) return 4;
else if ((bool)rb5.IsChecked) return 5;
else return 0;
}
Filip Popic