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
Printable View
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
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.
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#
Don't try to port the game too literally. Create an array and create the picture boxes in there in code. It's easier.
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.
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
well my only other suggestion would be to use a hash table and create some type of reference key for each pic box