re-using a picture variable

I’ve created a class to do things with pictures and am having trouble re-using the same variable.

I begin:

dim pic as picture

then

pic=new picture(1, 16)

then later I want a different sized picture, having finished with the first one, but

pic=new picture (16, 1)

throws up an error. Do I have to keep using new variable names every time I want a new picture? I am sampling different bits of another picture and processing the pixels, and I suppose I could do that, but can’t I just destroy the pic I have finished with and open a fresh one with the same variable name? I have tried using redim, which doesn’t work, and pic.destructor doesn’t seem to exist.

Seems valid. What error are you getting and what code are you using?

Try:
pic = nil

pic = nil will free it now. Else it will be freed anyway in the next assignment.

OK, pic=nil has sorted it. I should have thought of trying that - thanks!

Oliver S-B - I see you are in North Yorkshire. So am I - in Scarborough.

“Are you going to Scarborough Fair?”

Sorry, I couldn’t resist to that.

On the other part of the Cannel, I watcher D-Day 70th… and saw a bunch of English people, notable HM Queen Elizabeth II, son Charles and madame, grand-son William and Kate yesterday afternoon.

Grandiose !

[quote=96794:@Steve Hill]OK, pic=nil has sorted it. I should have thought of trying that - thanks!

Oliver S-B - I see you are in North Yorkshire. So am I - in Scarborough.[/quote]
Cool.I think I go there on holiday from time-to-time but I live in Ripon. Quite far away.

Yes, nice Cathedral

You been to Ripon Cathedral? I live just down the road (almost).

Have been away. Yes, I sang there with my school choir quite a few years ago.