Results 1 to 5 of 5

Thread: FileSystemWatcher: Out Of Memory error

Threaded View

  1. #1

    Thread Starter
    Fanatic Member Geespot's Avatar
    Join Date
    Oct 2001
    Location
    Birmingham, UK
    Posts
    577

    FileSystemWatcher: Out Of Memory error

    Hi,

    I have made a small application to monitor a directory. When I a new BMP file is added to that directory, my program converts it into a jpg file.

    I have achieved this by using the FileSystemWatcher class.

    Unfortunetely I recieved an 'Out Of Memory' error when a new bitmap file has been added to a folder.

    The problem code is below
    VB Code:
    1. Private Sub FileSystemWatcher1_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Created
    2.         ListBox1.Items.Add(e.FullPath)
    3.  
    4.         Dim img As Image
    5.  
    6.         img = Image.FromFile(e.FullPath)
    7.  
    8.         'blah blah blah, do something
    9.  
    10.         img.Dispose()
    11.  
    12.     End Sub

    I recieve the error on this line
    VB Code:
    1. img = Image.FromFile(e.FullPath)

    It never happens the first time this sub is called, its always on the second or greater.

    Im out of ideas on what it could be, your help is much appreciated

    Thanks
    Last edited by Geespot; Apr 14th, 2004 at 06:12 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width