O'Reilly Forums: Chapter 9 Data Binding Windows Forms - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Chapter 9 Data Binding Windows Forms adding a new customer

#1 User is offline   John Kranas 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 10-June 12

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?
0

#2 User is offline   Reza Shobeiri 

  • New Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 02-February 13

Posted 02 February 2013 - 11:00 AM

View PostJohn Kranas, on 10 June 2012 - 02:11 AM, said:

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?


I have the same problem! :(
0

#3 User is offline   JulieLerman 

  • Advanced Member
  • PipPipPipPipPipPipPipPip
  • Group: O'Reilly Author
  • Posts: 334
  • Joined: 17-September 08

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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users