Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

Can anybodytell me how to loop through multiple comboboxes added on a form grid & check for their initial values in wpf. If the initial value of any of the combobox is null then i should pop up a message.

I tried this, but i get error in the foreach expression:

C#
foreach (Control c in this.Controls)
               {
                   if (c is ComboBox)
                   {
                       ComboBox textBox = c as ComboBox;
                       if (textBox.SelectedValue == null)
                       {
                           MessageBox.Show("please fill all fields");
                           break;
                       }
                   }
               }




Thanks in advance.
Posted

1 solution

I think this will help you.

http://dirk.schuermans.me/?p=585[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900