BindingManagerBase AddNew
I'm having a problem in adding a new, blank record to a dataset by using the AddNew method of the BindingManagerBase object (VB.NET). It only occurs if there is a checkbox on the form whose checked property is bound to the database. I'm assuming it's because the checkbox object doesn't have a null value, so the BindingManagerBase object doesn't know what to do with that control for the new record. This has to be a common problem- I've got a basic data form with simple bound controls connected to a MSAccess database, and I can't make it work if I use checkboxes. Any ideas?
[617 byte] By [
pescado] at [2007-11-11 7:55:23]

# 1 Re: BindingManagerBase AddNew
What if you set a default value for the Yes/No field in the database, so that it's no longer null for new records?
# 2 Re: BindingManagerBase AddNew
I Googled for "BindingManager AddNew CheckBox" and found this:
http://groups.google.com/group/microsoft.public.dotnet.framework.adonet/browse_thread/thread/4233be0efde208ee/0d4184412922c421
Note this comment from Felix Wu:
Please note that if you have bind data to CheckBox or Radiobutton controls, the BindingManager are not able to clear the controls when AddNew method is called. This is a known issue in the control and will be fixed in later release, but we can workaround this problem by making a little changes to the .xsd file.
# 3 Re: BindingManagerBase AddNew
Unbelievable. I found a hint in the comment you attached from Felix Wu where he says to workaround the problem by making a change to the .xsd file. I had to set the default attribute to "true" (or "false"- doesn't matter) for the element corresponding to the checkbox data field. Why wouldn't Visual Studio do this for you when you generate the dataset if you have entered a default value for the field in the database? Am I the only person who wants to bind a checkbox to a database field? Strange. I guess I would like to know if there was some other obvious way around this, or if this convoluted solution is the only one. Odd. Thanks for the tip Phil.