Hi all.
Is it possible to create new instances of a PictureBox? Like you do for a Form?
I tried the following code:
What am I doing wrong here?Code:Dim Pic as PictureBox 'That works well
Set Pic = New PictureBox 'That does not work at all!
Thanks.
Printable View
Hi all.
Is it possible to create new instances of a PictureBox? Like you do for a Form?
I tried the following code:
What am I doing wrong here?Code:Dim Pic as PictureBox 'That works well
Set Pic = New PictureBox 'That does not work at all!
Thanks.
The first line is enough. No need the second line. TQ
I tried it, and it doesn't create a PictureBox, it creates a "pointer" to a picturebox pointing on "Nothing". So when entering:
I get the following error:Code:pic(i).Scalewidth = 100 'for example
"Object variable or With Block variable not set."
Any suggestions?
What you do is...
First you create a picturebox and name it picNameOfPic (or whatever)
and you set the Index value to 0 and set the visibility to true(at design time)
then you put the following code in your program...
If you still need any Help you can ask me whatever the problem is...Code:
Dim i As Integer
For i = 0 to 10
'Note that picNameOfPic(0) is already loaded and thus
'would generate an error if you try to load it again...
'However, if you do wanna 'reload' it, you might want to
'consider unloading it the same way as u loaded it.
'Example:
'Unload picNameOfPic(i)
'Its simple actually...
If i Then 'i <> 0
Load picNameOfPic(i)
picNameOfPic(i).Visible = True
picNameOfPic(i).Left = picNameOfPic(i - 1).Left + 100 'Move Right 100
picNameOfPic(i).Top = picNameOfPic(i - 1).Top + 100 'Move Down 100
'etc....
End If
'If you want to load an Image into those pics...
picNameOfPic.Picture = LoadPicture(App.Path & "/imageName.gif")
Next i
Good Luck with this one...
Thanks Man!
Sorry again for the wrong reply on the other thread...
Ciao!
no, no... its cool.
No need to appoligize, u did ur best to help.
And now u just learned something new... thats what programming is all about.