Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Load Colors by Name
Author:
Mike Renaud
Submitted:
3/8/2007
Version:
VB.NET 2003
Compatibility:
VB.NET 2003, VB 2005
Category:
Forms
Views:
11984
How to load system colors by name in a combobox there are many ways.. but this is one of them and Set colors name.
Declarations:
'none
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim typ As System.Type = GetType(System.Drawing.Color) Dim aPropInfo As System.Reflection.PropertyInfo() = typ.GetProperties() For Each pi As System.Reflection. _ PropertyInfo In aPropInfo If pi.PropertyType.Name = "Color" _ And pi.Name <> "Transparent" Then Me.ComboBox1.Items.Add(pi.Name) End If Next Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged frm.BackColor = Color.FromName _(Me.ComboBox1.SelectedItem) End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement