-
October 25th, 2009, 10:07 AM
#1
creating an array of colors
ok this is weird, im trying to create an array of colors. approach 2 doesn't work and i do not know why
Code:
'approach 1: works
Dim list As Color() = New Color() {Color.FromArgb(255, 0, 0), Color.FromArgb(0, 255, 0), Color.FromArgb(0, 0, 255)}
Code:
'approach 2: fails.. why?
Dim list() As Color = New Color() {Color.FromArgb(255, 0, 0), Color.FromArgb(0, 255, 0), Color.FromArgb(0, 0, 255)}
if instead i wish to create an array of strings, both approach works, that's weird
-
October 25th, 2009, 11:47 AM
#2
Re: creating an array of colors
[Moved to VB.NET]
I tried both ways and it is working. If you are trying to use both of them together in the same block then you will receive an error saying that "local variable is already declared in the same block".
Last edited by Shuja Ali; October 25th, 2009 at 11:54 AM.
Reason: Added a reply.
-
October 26th, 2009, 08:15 AM
#3
Re: creating an array of colors
Can't see why any of those would fail, didn't fail with me...
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
|