Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Help! Image.FromFile() causes out of memory exception

Help! Image.FromFile() causes out of memory exception

Scheduled Pinned Locked Moved Visual Basic
helpquestiondata-structuresjsonperformance
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alman
    wrote on last edited by
    #1

    :(Help! I'm trying to load an icon file into a picturebox using the following code: PictureBox1.Image = Image.FromFile("cow.ico") When executed an "Out of Memory Exception" is thrown every single time. My development machine has 1GB of RAM, and when this happens I have well over 1/2GB of physical memeory available, never mind the page file. The rest of the program isn't very big. There is an array of about 3000 elements in there, but the exception is thrown before that array is initialized or filled. Could this be a problem with my icon file? I use it in several other places with no problems... It does have every possible icon size/colour depth but is only 49K on the drive. What is also curious is that this line works fine (it follows the above) when I comment the picturebox line out: Me.Icon = new Icon("Cow.ico") -Allan

    D 1 Reply Last reply
    0
    • A alman

      :(Help! I'm trying to load an icon file into a picturebox using the following code: PictureBox1.Image = Image.FromFile("cow.ico") When executed an "Out of Memory Exception" is thrown every single time. My development machine has 1GB of RAM, and when this happens I have well over 1/2GB of physical memeory available, never mind the page file. The rest of the program isn't very big. There is an array of about 3000 elements in there, but the exception is thrown before that array is initialized or filled. Could this be a problem with my icon file? I use it in several other places with no problems... It does have every possible icon size/colour depth but is only 49K on the drive. What is also curious is that this line works fine (it follows the above) when I comment the picturebox line out: Me.Icon = new Icon("Cow.ico") -Allan

      D Offline
      D Offline
      dynamic
      wrote on last edited by
      #2

      i just tried it and it worked fine : PictureBox1.Image = Image.FromFile("C:\7.ico") you must have the exact path of the image in there or it will error. switch(twinsOnWay) { case ("twins on the way"): MessageBox.Show("for mr and mrs dynamic","twins on the way"); break;

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups