Results 1 to 4 of 4

Thread: Duplicate Picture Boxes on Form through code in run-time...

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2000
    Location
    PA
    Posts
    7

    Arrow

    Hello everyone,
    I am in the process of designing a way to play the Star Wars Customizable Card Game over the internet. But that is irrelevant. Basically, if anyone can help, I would like to know how to duplicate a picture box on a form through code in run-time, because I need to do this during certain points in the game, and the deck sizes can be different, so I need to variably create these cards during run-time. Do I have to somehow create a Class for a PictureBox. I have no clue, and if anyone at all can help me I would extremely appreciate it. Thanks for reading this.

    Kevin

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    The picture box has to be part of a control array (set the Index property to 0).
    Now you can load a new picture box.
    Code:
    Public Sub AddPicture()
        Dim iUbound%
        'this code assumes your picture box is called Picture1
        iUbound = Picture1.UBound + 1
        Load Picture1(iUBound)
        With Picture1(iUBound)
            'change the newLeft and newTop
            'to correct values
            .Move newLeft, newTop
            .Visible = True
        End With
    End Sub
    Good luck!

  3. #3
    Lively Member
    Join Date
    Aug 2000
    Posts
    125
    put the first picturebox on your form as an array
    (set the index property to 0)

    then create the new pictures with

    Load Picture1(num)

    num starts with 1

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2000
    Location
    PA
    Posts
    7
    Ok, great, thank you very much for both of your help, and I got it working. That was a very quick response, and that is great. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width