|
-
Jan 21st, 2004, 02:07 PM
#1
Thread Starter
Addicted Member
picturebox array??
is there a way to have an array of picturebox like in VB?? im porting a game from VB to C# and it uses an array of pictureboxes
*Rudy^
Visual Studio 6 Ent. SP5
Windows 2000 SP4
Windows XP SP1a
-
Jan 21st, 2004, 03:24 PM
#2
Addicted Member
Have a method make a null picturebox object then add a loop that keeps creating a new picturebox. each loop set the properties for the picturebox, maybe set something to the id property to have something to identify it by, then add it to the forms components collection. Then loop and repeat the steps for each picturebox u wish to add. Sorry i cant really write a snippet for u right now i am at work.
-
Jan 21st, 2004, 09:05 PM
#3
Thread Starter
Addicted Member
well the thing is that the pictureboxes are already preplaced on the form (in a weird complicated way) but i cant do like in vb and name them the same and just refer to them as picSpace(0) etc...
could i start an array and maybe link each of them to a picbox?
like Space(0) -> picSpace0
Space(1) -> picSpace1
.
.
.
Space(60) -> picSpace60
sorry if i sound like i noob but im new to C#, i have a background in C++ and VB but never tried C#
*Rudy^
Visual Studio 6 Ent. SP5
Windows 2000 SP4
Windows XP SP1a
-
Jan 22nd, 2004, 06:21 AM
#4
Don't try to port the game too literally. Create an array and create the picture boxes in there in code. It's easier.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 22nd, 2004, 07:44 AM
#5
Addicted Member
Rudy, check this out http://www.vbforums.com/showthread.p...ntrol+run+time. Pirate was able to answer my control array question. I hope this helps.
-
Jan 22nd, 2004, 12:32 PM
#6
Thread Starter
Addicted Member
thanx everyone, the only problem is that the board doesnt really have a pattern so placing the picboxes at run time would be really hard
*Rudy^
Visual Studio 6 Ent. SP5
Windows 2000 SP4
Windows XP SP1a
-
Jan 22nd, 2004, 04:08 PM
#7
Addicted Member
well my only other suggestion would be to use a hash table and create some type of reference key for each pic box
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
|