For two times in a row this week I was asked to do a buddy check of .NET code that performs databinding. I found out that the order of the binding operations is very important:
- Set the DisplayMember and/or ValueMember first
- Set the DataSource property after that
You will avoid many exceptions this way 😉
Scott McMaster at CodeProject has more information regarding this weird databinding Windows Forms issue.