1. I've discovered that if the textboxes are bound to the bo, the grid is not syncronized with the textboxes. If I select a record on the grid, the textboxes do not reflect this change. To fix this, I bound the textboxes to the businessbindingsource as well. This solved the problem. Is there an advantage to binding textboxes (and other controls) directly to the bo instead of the bindingsource? I'd prefer to bind all my controls to the binding source since I use many 3rd party controls.
2. Now that I've bound the textboxes to a businessbindingsource, they are not readonly. When bound to the bo, they are readonly until the edit button is pressed. How can I get the same behaviour when binding to the businessbindingsource.
3. If I decide not to use edit button (and have the controls editable without users having to click the edit button), I would like the save and undo buttons to become enabled as soon as the user starts making changes (eg. user presses a key in a textbox). First I tried using the textChanged event to set businessobject.edit. This didn't work because the event is fired whenever the textbox is populated.What is the best way to accomplish this behaviour?
Actually, I think that you may be making life much harder than it needs to be. We were just trying to give you some ideas based on what you posted. There are many different reasons developers do different things and we were just trying to accomodate your current question.
Your current problem is that you want the state of the BO to change without tabbing....well, this actually defies how data-binding works in .NET. The validating event is actually what triggers the binding contexts within .NET to update the bound element. So in that example you will have to leave the field (or at least attempt to leave the field) before the underlying context is updated and referenced. The reason for this is efficiency and speed. If the underlying data is updated with each keystroke, you will hve a very slow performing environment....especially over time and the larger your forms (or bound controls within the environment) become.
I understand and agree with you. My only concern is if a user wants to edit only 1 field, he would have to tab out before the save button will be enabled. You're right, this is turning out more complex than it needs to be. I will simply handle the keydown event instead of the textchanged event. I wanted to avoid doing this because if a user right clicked on a textbox and clicked on paste in the context menu, the save button still would not be enabled. It's an issue i'll have to fix later.
I think the problem I ran into when doing it that way was that the grid and the texboxes were not synchronized. The current record on the grid was not the record displayed on the textboxes. I'll give it another shot.