I'm trying to create a new control that inherits the ComboBox. I've added a new method that does what I need, but I'd like to access it through ComboBox.Items while keeping everything else intact. Shadowing seems to wipe out the entire Items subclass. I can live with it the way it is if this isn't possible, but it seems more logical to me to have the method in the Items subclass.
Is there any way to do this?
Public Class AdvComboBox
Inherits System.Windows.Forms.ComboBox
Public Class ComboItem
Dim Text As String
Dim ID As Long
Public Sub New(ItemText As String, ItemID As Long)
Text = ItemText
ID = ItemID
End Sub
Public ReadOnly Property ItemText
Get
Return Text
End Get
End Property
Public ReadOnly Property ItemID
Get
Return ID
End Get
End Property
End Class
'This is the method I'd like to access from ComboBox.Items
Public Sub AddAdvItem(DisplayText As String, ID As Long)
DisplayMember = "ItemText"
ValueMember = "ItemID"
Items.Add(New ComboItem(DisplayText, ID))
End Sub
End Class