Please allow me to clarify my situation and approach.
I have an excel file with 10 columns. First five columns have data which form the conditions for the query, while the last five columns contain data which form the result.
I am trying to make a software with this data in a database or excel (if database is difficult) where the first five columns will be linked to a List or Menu or presently RadioButtons in five different groups. When the selections are made and SUBMIT button is pressed, the result will be displayed as five data from matching rows in the excel or database.
That is what I am trying to achieve.
Please comment if my approach is wrong. Thanks in advance to all the posts.
--------------------------Original Question----------------------------
I have 5 groupboxes(1 has 5 radiobuttons, 2 has 3, 3 and 4 has 11, and 5 has 4 ) on a WPF. Based on which radiobutton is selected from each groupBox, the software is expected to give four parameters output (from a CSV or a database)
I have used How do I get which radio button is checked from a groupbox? the code from this given by King King, and modified it to use for my purpose.
var checkedRadio = new []{groupBox1, groupBox2, groupBox3, groupBox4, groupBox5}.SelectMany(g=>g.Controls.OfType<RadioButton>().Where(r=>r.Checked));
foreach(var c in checkedRadio)
MessageBox.Show(c.Name);
What this gives me is the radiobuttons selected one after another as message box.
I want to thank King King, and the many others (more than 20) whose answers for various answers helped me reach this point.
Where I am stuck is how to use the foreach loop to assign values to five separate int and then use it to calculate a final int value which I can assign to various results I want to display.
I tried to assign values to int in each CheckedChanged event handler but all of them are private void and not returning anything. I tried to change them to return ints but I can't seem to crack that nut.
I am sure my whole approach could be wrong here, but I have not much idea in this.
//What I basically want is to give options in g=five groups, and based on selections from these five groups (columns in an excel), display results from 4 corresponding columns in the matching row in a database. My present approach above is a workaround since I have no knowledge of working with databases.//