0
Answer

Removing BinderManagerBase from Form.BindingContext: possible?

Hi there. That's basically my question but before anything else, I would like to discuss the things that led me to this problem. I'm not really a GUI programmer; more of an SQL and data architecture. I have to do some prototyping this time though. I have a form about guest information. The only important fields for this discussion however are the lastName, firstName and middleName which are displyed by three textbox. These textboxes are also used for entering criterion/criteria to search a guest. I was able to bind the object Guest to all the corresponding field. The insert and update work fine. However I experience quirks and it has something to do with the PropertyManager or BindingContext (right now, I don't know which object to tweak) When a user wants to search, these are the steps 1) He must press "New Search" button. 2) The lastname, firstname, middlename textboxes clear their content. 3) The "Search" button is enabled whenever any of the textbox is supplied with value. 4) The user may press "Search" button Detailed 1) In the searchButton_click eventhandler, I call the PropertyManager.SuspendBinding() method so that clearing the 3 textboxes wont affect the current Guest object bound to the control. 2) I found out that clearing the textboxes after calling the SuspendBinding() indeed prevents the firing of PropertyManager.CurrentChange event. A user then will enter a value on any of the 3 textboxes (lname, fname, mname). But after any of the textboxes loses focus, the CurrentChange event fires and the other textboxes are filled with the values of the current object bound to the PropertyManager. I thought SuspendBinding() prevents this from happening. This is incorrect because it should be the user who will enter the search criteria. I resort to another strategy this time. I thought that removing the BindingManagerBase object from the Form.BindingContext also removes the binding of the Guest object to the controls. The problem is, I don't know the syntax for this. :( So there you go folks. My problem is how to remove the binding of a particular object to the controls using BindingManagerBase object or the Form.BindingContextObject so that the Search scenario described above will be realized. Thanks.