Image.FromFile has an irky bug within its definition.
Use Image.FromStream instead
VB Code:
Private Sub FileSystemWatcher1_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Created ListBox1.Items.Add(e.FullPath) Dim img As Image Dim fs As New System.IO.FileStream(e.FullPath,Read) img = Image.FromStream(fs) fs.Close 'blah blah blah, do something img.Dispose() img =Nothing End Sub




Reply With Quote