PictureBox

comcrack

Regular
Joined
Jun 14, 2003
Messages
52
Location
Canada
Hy,

How can I create a picturebox when the program is running? I tryed this but the picturebox didn't appear on my form. :




Visual Basic:
Public Sub Continue_Champ()
        Dim tempimage As New System.Windows.Forms.PictureBox
        tempimage.Location = New System.Drawing.Point(Me.Width / 2, Me.Height / 2)
        tempimage.Name = "Champ" & colone.Count
        tempimage.Size = New System.Drawing.Size(88, 32)
        tempimage.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(128, Byte), CType(128, Byte))
        tempimage.show
End Sub





I also tryed a pictureboxarray but when I use pictureboxarray1.load(0) It say that :

There are no controls in this control array. loading an existing control requide an exiting control to clone


But I don't know what it mean.



Hope you can help me,

Thank you,

ComCrack
 
Pictureboxarray problem!

create a separate picturebox with any name such as "pic"

in da code window expand "windows form designer code"

en the " 'pic1 "section add these lines

" Me.pictureboxarray1.SetIndex(Me.pic1, CType(0, Short))"

then run it with ur normal code! u got ur box to clone...
 
I would stay away from the PictureBoxArray class if at all possible. It is there strictly for compatability with VB6. The nearest appropriate .Net equivalent would be to create your own array and manually populate it, but if you only need one picture box, you hardly need an array.
 
Back
Top