# Visual Basic > Visual Basic 6 and Earlier >  [RESOLVED] Copying a StdPicture?

## Elroy

Ok, what's the best way to copy a StdPicture?

I've got a picture in a PictureBox, but I'd just like to save it off into a StdPicture object, and then clear the PictureBox for other uses.  Basically, I'll have an array of StdPicture objects.

I suppose I can use the Render method, but just wanted to make sure that's the best way to do it.

----------


## VanGoghGaming

Use "IPicture" instead of "StdPicture".



```
Dim xPic as IPicture
Set xPic=Picturebox1.Picture ' if Autoredraw is True
Set xPic=Picturebox1.Image ' if Autoredraw is False
```

You can also persist these pics in a property bag if you want to reuse them later on.

----------


## Elroy

> Use "IPicture" instead of "StdPicture".
> 
> 
> 
> ```
> Dim xPic as IPicture
> Set xPic=Picturebox1.Picture ' if Autoredraw is True
> Set xPic=Picturebox1.Image ' if Autoredraw is False
> ```
> ...


Isn't that just going to create another reference to a single image/picture?  I'll test.

----------


## Elroy

Hmmm, ok.  I think it is making another reference, but that's good enough.  When the picturebox is cleared, it doesn't clear that reference, but rather starts another object.  So this is perfect.

----------


## VanGoghGaming

Well yeah, it wouldn't be of much use if it weren't... I was playing with shuffling a deck of cards using "CryptGenRandom" and I used these "IPicture" objects in the process:

----------


## VanGoghGaming

Also I suppose it would be a little faster if you drew your image in a memory bitmap and then assign it to a "IPicture" rather than going through a Picturebox but I don't know the requirements of your project.

----------


## Elroy

> Also I suppose it would be a little faster if you drew your image in a memory bitmap and then assign it to a "IPicture" rather than going through a Picturebox but I don't know the requirements of your project.


It was already sitting in a PictureBox, so this is all perfect now.  Thanks.   :Smilie:

----------

