R – Problem Binding WinForms CheckBox To SubSonic DAL Boolean

subsonicwinforms

I am trying to bind a SubSonic 2.1 generated DAL object to a WinForm (VB.NET VS2005). In order to work around the lack of IPropertyNotifyChanged implementation, in my binding method I am doing a controlname.DataBindings.Clear() before a controlname.DataBindings.Add() for each control I want to bind.

Textboxes work fine with code like this (ioBLL is the reference to my BLL object, and ioDAL to the DAL property within it):

txtCountryName.DataBindings.Add(New Binding("Text", ioBLL.ioDAL, namespace.Country.Schema.Columns.GetColumn("CountryName").ToString, True, DataSourceUpdateMode.OnPropertyChanged))

but when binding to a checkbox

chkObsolete.DataBindings.Add(New Binding("Checked", ioBLL.ioDAL, namespace.Country.Schema.Columns.GetColumn("Obsolete").ToString, True, DataSourceUpdateMode.OnPropertyChanged))

it never appears ticked at runtime when the underlying property value is True.

Any ideas why?

Best Answer

Is ioBLL.ioDAL.Obsolete a boolean ?

I use very similar code without problems.

Perhaps the only difference is that I use a BindingSource.

IE I use a bindingsource on my form and set it's DataSource to ioBLL.

Ive had other issues binding controls directly to my entities, but I dont recall the problem you describe as being one of them.

Related Topic