Picture Boxes and running out of memory

Im new to VB.NET but have used VB6 quite a bit. Im writing an app with a picture box that I use as an image browser. ie I set the image to a JPEG picture and when the user hits a key i set it to another JPEG picture etc. But after showing about 20 pictures, it seems to run out of memory. Ive tried using Dispose to unload the current image before loading a new one but it doesnt seem to work. Can anyone tell me what i need to do?

This is what my code does repeatedly:
picPicture.Image = Image.FromFile(FileName)

Comments

  • : Im new to VB.NET but have used VB6 quite a bit. Im writing an app with a picture box that I use as an image browser. ie I set the image to a JPEG picture and when the user hits a key i set it to another JPEG picture etc. But after showing about 20 pictures, it seems to run out of memory. Ive tried using Dispose to unload the current image before loading a new one but it doesnt seem to work. Can anyone tell me what i need to do?
    :
    : This is what my code does repeatedly:
    : picPicture.Image = Image.FromFile(FileName)
    :

    OK, i figured it out. A bit of an oops on my part. It was always crashing on the same image, which isnt actually an image, its an AVI file :) And since the picture box doesnt support AVI files, it gives an out of memory exception (according to MSDN, but i dont know why).
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion