Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15430

[RESOLVED] Why does my picturebox not take an image ?

$
0
0
Hi,

I'm adding a row of pictureboxes to my form using this code (you can assume all variables have been properly declared)
Code:

        bxw = Me.Width \ 40 : bxh = CInt(bxw * 1.333)
        x = 10 : y = PictureBox1.Location.Y + pbh + 25
        For i = 12 To 52
            Dim px As New PictureBox
            px.Name = "PictureBox" & i.ToString
            px.Height = bxh
            px.Width = bxw
            px.Location = New Point(x, y)
            px.BackColor = Me.BackColor
            px.Image = card(0)
            px.Visible = True
            Me.Controls.Add(px)
            x += bxw + 1
        Next

There are already 11 pictureboxes so the new ones start at PictureBox12.
If I change the BackColor to (say) red, all boxes are displayed, so I know they are there.
However, none of 'em have an image. I can't add an image to 'em later in the programme, but I can change their backcolour.
Why can't I add an image? I know the image is valid, I use it elsewhere. I've tried changing the image to a different (valid) one, but it just doesn't happen.


Poppa

Viewing all articles
Browse latest Browse all 15430

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>