I having a similar problem; getting an InvalidCastException using version 1.41. I have a standard SF maint. form. On the form I have two controls, a textbox and combo box. The combo box is populated by an enumeration and is bound to the BO. The text box is bound to a string property on the BO. If I open the maintenance form and click on “New” I can add a new record with no error. However if I click on browse, retrieve some records and then click “New” I get the InvalidCastException. If I unbind the combo box from the BO everything works fine.
-Larry
When you use an enumeration to populate a combobox, the SelectedValue (which is what the combobox will bind to by default) actually contains enumeration values, not integer values. So, to bind to that combobox, you'll need to go to the BOMapper and customize the field to return the enumeration value rather than an integer.
If you don't want to customize the field, you'll have to populate the combo manually, or it will continue to throw the InvalidCastException