I have a subroutine that I modified from code I found in this forum
(thanks). I'll include it below for public use, and to illustrate my
problem. The sub accepts a ListBox control and an enumeration. It
creates a datasource from the enum and sets the ListBox to use the
datasource. If I pass a ComboBox (which is derived from ListBox) into
the sub, I get a warning about the implicit conversion back to a
ComboBox when the Sub exits. Is there a way to avoid this warning?
Here is the Sub:
Private Shared Sub LoadEnumIntoLC(ByVal typedata As Type, _
ByRef lc As ListControl)
Dim dt As New DataTable
dt.Columns.Add("Display", GetType(String))
dt.Columns.Add("Value", typedata)
For Each obj As Object In [Enum].GetValues(typedata)
Dim row As DataRow = dt.NewRow
row("Display") = obj.ToString()
row("Value") = obj
dt.Rows.Add(row)
Next
lc.DataSource = dt
lc.DisplayMember = "Display"
lc.ValueMember = "Value"
End Sub