|
-
Jan 24th, 2003, 03:33 PM
#1
Thread Starter
Member
Populating listbox with system colors
I searched the messages in this forum for a solution to this problem, and found several posts regarding how to populate a listbox control with the system colors. One of the more concise solutions I found went something like this:
Dim Colors() As String = KnownColor.GetNames_
(GetType(KnownColor))
Dim ColorEnum As String
For Each ColorEnum In Colors
If Not Color.FromName(ColorEnum).IsSystemColor Then
ListBox1.Items.Add(Color.FromName(ColorEnum))
End If
Next
So, with that portion of code in mind, would it be "wrong" to do this instead:
Dim Colors() As String = KnownColor.GetNames_
(GetType(KnownColor))
Dim ColorCounter As Integer
For ColorCounter = 0 To Colors.GetUpperBound(0)
If Not Color.FromName_
(Colors(ColorCounter)).IsSystemColor Then
ListBox1.Items.Add(Colors(ColorCounter))
End If
Next ColorCounter
basically, using a FOR-NEXT loop in place of the FOR-EACH loop? I don't know if this type of thing is frowned upon in VB.NET.
Just curious - any input would be appreciated!
--Steve K.
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|