I am trying to bind a label to a CheckedListBox.CheckedItems.Count I have tried a couple approaches to this and receive the message:
Cannot bind to the property or column Count on the DataSource. Parameter name: dataMember
My Code is as Follows:
Dim BgCountBinding As Binding = New Binding("Text", BgCheckedListBox.CheckedItems, "Count")
' I have also tried this:
' Dim BgCountBinding As Binding = New Binding("Text", BgCheckedListBox, "CheckedItems.Count")
BgCountBinding.DataSourceUpdateMode = DataSourceUpdateMode.Never
BgCountBinding.ControlUpdateMode = ControlUpdateMode.OnPropertyChanged
BgCountBinding.NullValue = "0"
BgCountBinding.FormattingEnabled = True
BgCountBinding.FormatString = "#: {0}"
lblBGCount.DataBindings.Add(BgCountBinding)
I know the code is VB but if you have a C# version - I can and will be happy to convert it.