Here is an example of the class/collection:
I tried binding the collection directly, but got an error: "Complex DataBinding accepts as a data source either an IList or an IListSource". So I added a "BindingSource" object and used it.
Public Class CBarCode
Private nBarCodeNumber As Integer = 0
Private sBarCodeValue As String = ""
Private sBarCodeType As String = ""
Private nBarCodePage As Integer = 0
Private sIndexField As String = ""
Public Class CBarCodes
Inherits Dictionary(Of String, CBarCode)
Here is an example of the code:
With this code, I get one value in the list: [0, CBarCode]
lstBarCodes.DataSource = CBarCodesBindingSource
CBarCodesBindingSource.DataSource = oBarCodes
'CBarCodesBindingSource.DataMember = "IDCSTProcess.CBarCode"
lstBarCodes.DisplayMember = "BarCodeValue"
'lstBarCodes.ValueMember = "BarCodeNumber"
If I uncomment the "DataMember" line, I get this error: "DataMember property 'CBarCode' cannot be found on the DataSource". If I uncomment the ValueMember line, I get "cannot bind to new value member. Parameter name: value".
It seems like it is trying to bind to the collection itself, rather than the members of the collection. This is where I think I am going wrong, and would like to see some examples of it being done.