Chapter 9 Data Binding Windows Forms
2 replies to this topic
Posted 10 June 2012 - 02:11 AM
There is a problem when trying to add a new customer. If you do everything by the book the example works perfectly but if you make a small change then you cant add a customer.
Specifically on the form there are 4 combo boxes. In the book we bind 2 of them in code and the other 2 with the UI.
Well if you bind them all with the UI or if you dont bind selecteditem but insted you bind selectedvalue on all 4 combo boxes then you cant add a new customer.
This is very strange and I cant figure out why this is happening. I've been stragling yesterday all day to find why this is happening but I cant figure it out. Maybe it is a problem with bindingsource. Any ideas?
Posted 02 February 2013 - 11:00 AM
I have the same problem!
Posted 02 December 2013 - 07:46 PM
I don't know exactly what problem is coming up here but I can tell you what I get when I data bind all four controls rather than databind some and bind the others in code.
Binding multiple controls to the same list in windows forms is an age old problem. Not EF. It happens with data tables too. When you change the pointer in one of the drop downs, it synchs the other drop down.
So if you bind activit1combo and activity2combo to the activitydatasource, any selection you make in the first combo will get reflected in the 2nd.
I don't know whey binding to the EDS that is populated from the same instance that I'm using to populate in FillCombos doesn't have the same effect. It's crazey EDS magic.
The safer bet is to use fillcombos for all 4 but with the extra combos (activity2 and destination2) I would create a separate instance of the List<activity> or List<destination> and bind to that.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users