I am seeing a strange behavior when a ComboBox on a Windows Form is bound to
a class that inherits from ArrayList. This class (ColumnEntryList) has only
one property; when this property is defined to take a single parameter, the
CB shows nameSpace.listItemType for each item in the list. When the property
is re-defined to take no parameters, the CB works as expected.
Perhaps someone has seen this or can explain this peculiarity?
Here's the code used:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim columns As New ColumnEntryList
columns.Add(New ColumnEntry("a", "Name"))
columns.Add(New ColumnEntry("b", "Address"))
columns.Add(New ColumnEntry("c", "Phone"))
Me.columnsCB.DisplayMember = "displayColName"
Me.columnsCB.ValueMember = "nativeColName"
Me.columnsCB.DataSource = columns
End Sub
End Class
Public Class ColumnEntry
Private _col_name As String
Private _display_name As String
Public ReadOnly Property nativeColName() As String
Get
Return _col_name
End Get
End Property
Public ReadOnly Property displayColName() As String
Get
Return _display_name
End Get
End Property
Public Sub New(ByVal NativeColumnName As String, ByVal DisplayColumnName
As String)
_col_name = NativeColumnName
_display_name = DisplayColumnName
End Sub
End Class
Public Class ColumnEntryList
Inherits ArrayList
'vv Remove this property's parameter for normal
behavior vv
Public ReadOnly Property dummy(ByVal i As Integer) As Boolean
Get
Return False
End Get
End Property
End Class