Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop through colors??

Status
Not open for further replies.

RichS

Programmer
Apr 24, 2000
380
US
Is there a way to loop through the colors available on a web form? something like:

Sub subShowColors()
Dim intCnt As Integer = 0
Dim Color As System.Drawing.Color

Dim tHeaderRow As New TableRow()
Dim tHeaderCell As New TableCell()

For Each Color In System.Drawing.Color
Dim tRow As New TableRow()
Dim tCell As New TableCell()

tCell.Controls.Add(New LiteralControl(Color))
tRow.Cells.Add(tCell)
tblColors.Rows.Add(tRow)
Next
End Sub

I'm having trouble with the syntax.
Thanks
Rich
 
The Color structure in the drawing namespace doesn't implement the ICollection interface so you cannot loop through the items at all. You could try building a string and changing the hex values for each color. But I think this would give you.. now that I think about it I know that this would give you way to many colors many would be indecernable to the eye.

Not really sure of a looping way to do this you may need to do it manually. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top