|
-
Oct 31st, 2000, 12:45 AM
#1
Hi all.
Is it possible to create new instances of a PictureBox? Like you do for a Form?
I tried the following code:
Code:
Dim Pic as PictureBox 'That works well
Set Pic = New PictureBox 'That does not work at all!
What am I doing wrong here?
Thanks.
-
Oct 31st, 2000, 02:05 AM
#2
New Member
The first line is enough. No need the second line. TQ
-
Oct 31st, 2000, 01:47 PM
#3
It does not seem to work...
I tried it, and it doesn't create a PictureBox, it creates a "pointer" to a picturebox pointing on "Nothing". So when entering:
Code:
pic(i).Scalewidth = 100 'for example
I get the following error:
"Object variable or With Block variable not set."
Any suggestions?
-
Oct 31st, 2000, 04:54 PM
#4
Fanatic Member
I had the exact same problem in a different thread
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...
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
If you still need any Help you can ask me whatever the problem is...
Good Luck with this one...
-
Oct 31st, 2000, 05:18 PM
#5
How ironic...
Thanks Man!
Sorry again for the wrong reply on the other thread...
Ciao!
-
Oct 31st, 2000, 07:53 PM
#6
Fanatic Member
No Problem.
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|