unloading resource bitmap from Image1.picture.bitmap

I have image1 on the form.
a bitmap is loaded runtime like this:
form1.Image1.Picture.Bitmap.LoadFromResourceName(hinstance, 'MYPIC');
now i need to unload the bitmap(MYPIC) and load the image1 with another bitmap 'HISPIC'.
I tried all possible procedures that come after form1.Image1.Picture.Bitmap. but nothing works. all raise access violation exceptions.
oalawnaAsked:
Who is Participating?
 
kretzschmarConnect With a Mentor Commented:
try

Image1.Picture := nil;

meikl ;-)
0
 
oalawnaAuthor Commented:
thanks
:-)
0
 
kretzschmarCommented:
above was to clear

to load another just use (a clear is not needed then)

Image1.Picture.Bitmap.LoadFromResourceName(hinstance, 'HISPIC');

you may notice that i left out the form1,
because as long as u do it in the same object-instance,
it is not needed, and it may be that the default-reference-variable is not used

meikl ;-)
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
kretzschmarCommented:
hups, that was fast :-))
0
 
oalawnaAuthor Commented:
Yes I know but i wanted to clear it like clearing labels for example. Nil works:-)
regards
0
 
kretzschmarCommented:
yep, thats the way to clear

glad to helped you

meikl ;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.