I have a listbox that is bound to a strongly typed data table. I also have a textbox in which the user can add items to the list, and the items will be added to the database. Whenever the user attempts to add items to the list, I iterate over the list and check to see if it's a duplicate, in which case i simply select the item in the list.
The weird thing that happens is whenever I rebind the list after adding an item, and attempt to add another item, I get an invalid cast exception when iterating through the listbox's Object Collection. The first time through, the Object Collection is populated with the strongly typed data rows, but after adding an item to the list, it's populated with DataRowViews. Is this normal, or am I missing something?