Put all colors in a ComboBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am building an application and would like to give the user the chance to
configure the look of the user interface.

I am adding a ComboBox to a DialogBox and want to populate it with the
available System background colors. The user can then set the background
color for the application. I will be doing the same with fonts, button
FlatStyles, etc.

I have tried a for each loop, but can't seem to get the syntax right.

Any help on any of these would be appreciated.
 
cashdeskmac said:
I am adding a ComboBox to a DialogBox and want to populate it with the
available System background colors. The user can then set the background
color for the application. I will be doing the same with fonts, button
FlatStyles, etc.

\\\
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), _
DirectCast(ListBox1.SelectedItem, String) _
), _
KnownColor _
) _
)
End Sub
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top