[2005] Inheriting Listbox to be type specific
Hello,
I am working on figuring out how to create a listbox that only accepts a specific type so that I can avoid changing types to and from the listbox.
I think that I need to make the listbox so that it uses a generic collection, and have the listbox use that instead of the object collection it uses by default. I am not totally sure how to go about that, and I am having trouble finding information about how to do it.
Here is the code I have so far. It isn't much, but...
Code:
Public Class GenericListBox
Inherits System.Windows.Forms.ListBox
Private _ItemCollection As New System.Collections.ObjectModel.Collection(Of FACCMemberType)
Protected Shadows Function CreateItemCollection() As System.Collections.Generic.ICollection(Of FACCMemberType)
Return _ItemCollection
End Function
End Class
I think I need to make a custom add method, but I am not sure if I need to shadow it, or if I just create my own public method. After that, I am not sure what else I need to do.
Can someone either point me to an article that will help me with this, or tell me what I need to do? I have googled and looked on MSDN, but haven't been able to find what I need, or maybe I just don't recognize what I need.
Thank you for your help.
Re: [2005] Inheriting Listbox to be type specific