"Anthony Sox" <tr*******@hotmail.com> schrieb:
Does anyone know if its possible to use an enum structure as a data source
for a combo box or list box. if not, is it possible to enumerate an enum
and
list it values
\\\
Private Sub Form1_Load( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles MyBase.Load
Me.ListBox1.DataSource = _
[Enum].GetNames(GetType(KnownColor))
End Sub
Private Sub ListBox1_SelectedIndexChanged( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles ListBox1.SelectedIndexChanged
Me.ListBox1.BackColor = _
Color.FromKnownColor( _
DirectCast( _
[Enum].Parse( _
GetType(KnownColor), _
CStr(ListBox1.SelectedItem) _
), _
KnownColor _
) _
)
End Sub
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>