i am trying to create a simple WPF Application which just has comboboxes and a submit button.
what i want to do is,
when i click the button,
my function should loop through all the Comboboxes and get their Content.
My XAML -
<ComboBox HorizontalAlignment="Left" Name="ComboBox2" > // the name goes from 2 to 50
<ComboBoxItem IsSelected="True">Y</ComboBoxItem>
<ComboBoxItem>N</ComboBoxItem>
<ComboBoxItem>NA</ComboBoxItem>
</ComboBox>
this is my onclick function
private void Submit(object sender, RoutedEventArgs e)
{
LinkedList<String> allnos = new LinkedList<string>();
for (int i = 2; i < 12; i++)
{
ComboBoxItem Item = (ComboBoxItem)Combobox+"i"+.SelectedItem; // this will not work, how should i get it?
allnos.AddLast(Item.Content);
}
}
HOW DO I loop through all the comboboxes to get the selected values?? Thanks in adv.